The Dow and the S&P 500 declined on Friday as May retail sales unexpectedly fell, though a better-than-expected read on consumer sentiment and strength in tech lifted the Nasdaq.

Total retail sales marked their first monthly drop in eight months, falling 1.2 percent in May -- contrary to economists' consensus forecast for a gain of 0.2 percent. The data underlined concerns about the consumer's strength in the

economic recovery.

The S&P Retail index <.RLX> fell 0.8 percent while Macy's Inc slid 0.7 percent to $21.13. Dow component Wal-Mart

Stores Inc dropped 0.5 percent to $50.97.

This confirms last Friday's jobs report number, which was definitely disappointing, said Peter Kenny, managing director of Knight Equity Markets in Jersey City, New Jersey.

In contrast to the weak retail sales, consumer sentiment improved in June to its strongest point in over two years, according to a preliminary reading for the month from the Thomson Reuters/University of Michigan Surveys of Consumers. The June reading easily topped forecasts, though it wasn't enough to lift the broad market.

This shows that the economy is still performing and much better than last year, though it really is only benign growth, said Rob Stein, managing partner of Astor Asset Management in Chicago.

The Dow Jones industrial average <.DJI> was down 24.03 points, or 0.24 percent, at 10,148.50. The Standard & Poor's 500 Index <.SPX> was down 4.83 points, or 0.44 percent, at 1,082.01. But the Nasdaq Composite Index <.IXIC> was up 7.76 points, or 0.35 percent, at 2,226.47.

The Nasdaq gained on strength in semiconductor stocks after National Semiconductor Corp forecast margins and revenues above estimates, signaling that demand is bouncing back after a miserable 2009 for the microchip industry.

The stock rose 2.4 percent to $13.85 while Altera Corp was up 1.6 percent at $24.04. The PHLX Semiconductor index <.SOXX> added 0.2 percent.

Big-cap pharmaceutical companies' shares also advanced after Barclays Capital upgraded the sector to positive from neutral, citing the revenue potential of new products.

Pfizer Inc was the Dow's top percentage gainer, rising 2.8 percent to $15.32, with Merck & Co not far behind -- up 0.9 percent at $34.57.

U.S.-listed shares of BP Plc climbed 3.8 percent to $34.04 as UK officials made supportive comments, even as scientists doubled estimates of the Gulf of Mexico's oil spill.

Also on the economic front, U.S. business inventories rose 0.4 percent to a 10-month high, slightly under the expectation for a 0.5 percent increase.

(Reporting by Ryan Vlastelica; Editing by Jan Paschal)