Sales at U.S. retailers unexpectedly fell in May for the first time in eight months, but a jump in consumer sentiment to a near 2-1/2 year high in early June tempered fears of a slowing economic recovery.

The drop in sales reported by the Commerce Department on Friday reflected weak gasoline prices and the end of a home buyer tax credit that had boosted sales of building materials.

Analysts said the underlying trend of steadily advancing consumer spending was intact -- despite some recent data that suggested a slowing of the recovery -- and there was little risk of the economy slipping back into recession.

We have placed a double-dip in the U.S. for a long time at 15 percent and that is still where we are. The most likely scenario is the economy continues to grow at a 3-percent pace, said Michael Strauss, chief economist at Commonfund in Wilton, Connecticut.

Total retail sales dropped 1.2 percent in May after rising 0.6 percent in April. Economists had forecast a May rise of 0.2 percent.

Receipts from building materials suppliers tumbled a record 9.3 percent in May after the expiration of incentives to boost the sale of energy-efficient appliances.

Gasoline prices, which normally rise in May, fell and weighed on the dollar value of sales.

Core retail sales, which correspond most closely with the consumer spending component of the government's gross domestic product report, rose 0.1 percent after dropping 0.2 percent in April.

The details for consumption are consistent with a still solid pace, with real consumer spending still on track for around a 3 percent rate of growth in the second quarter, down only modestly from 3.5 percent in the first quarter, said Jim O'Sullivan, chief economist at MF Global in New York.

CONSUMERS MORE UPBEAT

A surprise pull-back in private business hiring last month put consumer spending under the spotlight and fanned fears the economy's recovery from the longest and deepest recession since the 1930s was stalling.

Consumers, however, are becoming a bit more optimistic despite the recent plunge in share prices.

The Thomson Reuters/University of Michigan's Surveys of Consumers sentiment index rose to 75.5 early this month from 73.6 in May. That was above expectations for 74.5.

This reinforces the view that what moved sales in May was the unwinding of incentives to buy energy-efficient appliances, and other issues like weather, the price of gas, and so forth, said Nigel Gault, chief U.S. economist at IHS Global Insight in Lexington, Massachusetts.

If consumers were getting panicked, you'd have expected to see more worry showing up here.

Stocks on Wall Street initially fell as investors worried weak retail sales could hurt corporate profits, but reversed course after an upbeat revenue forecast from National Semiconductor Corp signaled a bounce back in demand for the microchip industry.

All key U.S. stock indexes ended up for a second straight day. Prices for U.S. government debt rose on the retail sales report, but the dollar firmed against the euro and yen as investors in that asset class focused instead on the improvement in consumer sentiment.

Restoring the economy to health is a key priority for President Barack Obama, and voter anguish over the slow pace of the recovery could inflict heavy losses on the Democratic Party in November's Congressional elections.

Consumer spending accounts for about 70 percent of U.S. economic activity, but with the unemployment rate near 10 percent, households have become more cautious than in previous recoveries.

The Federal Reserve, which has cut benchmark interest rates to near zero to revive the economy, is widely expected reiterate its pledge for ultra-low borrowing costs for an extended period when it meets later this month.

Chairman Ben Bernanke this week said the economic recovery was on a solid footing, but he remained concerned about jobs.

Last month, motor vehicle and parts receipts fell 1.7 percent, although dealers reported a rise in sales volumes.

Excluding autos, sales fell 1.1 percent in May, the largest decline in 14 months, after rising 0.6 percent in April.

There were some bright spots, with sales at sporting goods, hobby and book stores rising 0.4 percent in May after falling 1.3 percent in April. Receipts at electronics and appliance stores rose 0.6 percent, reversing the prior month's fall.

In another report, the Commerce Department said business inventories hit a 10-month high in April, while sales were at their highest level since October 2008.

Inventories are a key component of gross domestic product changes over the business cycle and the rebuilding of merchandise stock from record low levels is one of the key drivers of the economy's recovery.

(Additional reporting by Richard Leong; Editing by Chizu Nomiyama and Padraic Cassidy)