Best Buy Co Inc posted lower first-quarter earnings and weaker-than-expected sales on Tuesday and also implied earnings for the rest of the year would be worse than forecast, dragging its shares down 3 percent.

The top U.S. specialty consumer electronics retailer said it gained market share after main rival Circuit City closed its doors. Still, fewer customers visited its U.S. stores in the quarter as consumers continue to cut back on discretionary purchases.

Best Buy saw demand rise when Circuit City shut down but has also faced increased pressure from Wal-Mart Stores Inc and others adding laptop computers, flat-screen televisions and other products to their stores.

The company's lower profit still topped analysts' expectations. Analysts said they were pleased to see improvements in gross margin and the market share gains.

Gross profit rose to 25.3 percent of revenue from 23.7 percent a year earlier, aided by the inclusion of Best Buy Europe and a 70-basis-point increase in gross profit in the U.S. business, where Best Buy had bettrol over promotions and lower freight and logistics costs.

The sales environment hasn't necessarily gotten better and so it's going to be interesting to see how much Best Buy can continue to push on the gross margin and the expense line if sales deteriorate further from these levels, said Brad Thomas, an analyst with KeyBanc Capital Markets who has a buy rating on Best Buy shares.

Sales at stores open at least 14 months declined the most during May, which faced a tough comparison to a year earlier, when consumers came into Best Buy's stores to spend government stimulus checks.

The company estimated that as of April 30 its U.S. market share grew by nearly 2 percentage points from a year earlier.

Sales of gaming items, digital cameras, appliances and movies fell, while notebook computers, mobile phones and repair services sold well.

They're definitely sort of playing defense right now, but when the consumer starts to come back they're going to be in a great position, said FTN Equity Capital Markets analyst Anthony Chukumba, who rates the shares buy.

He said if and when consumers start shopping again, Best Buy could surpass its profit forecast for the year.

PROFIT FALLS

Best Buy said it earned $153 million, or 36 cents per share, in the fiscal first quarter ended on May 30, down from $179 million, or 43 cents per share, a year earlier.

Excluding restructuring charges, Best Buy said adjusted earnings fell to 42 cents per share from 43 cents per share. Analysts had expected Best Buy to earn 34 cents per share on that basis, according to Reuters Estimates.

Best Buy has cut jobs and slowed new store openings while also expanding sales of mobile phones as it works on remaining at the top of consumers' minds in the downturn.

Revenue rose 12 percent to $10.1 billion, aided by sales at new stores. Analysts, on average, expected revenue of $10.19 billion.

I don't think the sales weakness should come as a total surprise as investors, Thomas said.

He said government retail sales data had already shown that in March, April and May there was a slowdown in sales trends for the consumer electronics and appliance sector.

Sales at stores open at least 14 months fell 6.2 percent overall and 4.9 percent in the United States.

Best Buy stood by a forecast it gave in March, calling for fiscal year earnings of $2.50 to $2.90 per share, excluding restructuring charges.

Shares of Best Buy fell 3.1 percent to $37.47 in morning trading.

(Reporting by Jessica Wohl, editing by Dave Zimmerman)