Best Buy (BBY) reported stronger-than-expected first-quarter earnings on Thursday despite a softening in demand for consumer electronics.

However, the retailer maintained its bleak near-term view, saying it anticipates “ongoing” industry-wide sales declines in many consumer electronic categories and negative same-store sales over the next two quarters.  

Revenue for the three months ended May 3 fell to $9.04 billion from $9.35 billion a year ago, missing the Street’s view of $9.2 billion. Same-store sales, a key growth metric, slumped 1.9% as demand for consumer electronics softened.

Yet, the Richfield, Minn.-based retailer swung to a quarterly profit.

It reported net income of $461 million, or $1.33 a share, compared with a year-earlier loss of $81 million, or 24 cents.

Excluding one-time items related to its overhaul and a new credit card agreement, Best Buy reported adjusted earnings of 33 cents, topping average analyst estimates of 20 cents in a Thomson Reuters poll.

“We achieved market share gains in the U.S., fueled by our improved price competitiveness and an enhanced customer experience focused on advice, service and convenience,” Best Buy CEO Hubert Joly said in a statement.

Shares of Best Buy edged of 5.6% to $26.78 in recent trade.

Follow Jennifer Booton on Twitter at @Jbooton