The Nasdaq and the S&P 500 rose slightly on Thursday as investors unloaded consumer staple and healthcare stocks and bought technology and commodity-related shares.

Lower initial claims for jobless benefits and weak monthly retail sales figures did not give direction to the market, which is now focused on earnings reports scheduled for the next few weeks.

Alcoa Inc rose 0.3 percent to $9.49 after posting a third consecutive quarterly loss Wednesday, though the deficit less than estimated. Materials shares in general were stronger, however, leading the S&P 500.

Alcoa results eased investor worries about corporate earnings, but the loss by the largest U.S. aluminum maker underscored the pain inflicted on corporate results by the severe recession.

Shares of healthcare companies were among the biggest drags, with Dow component Merck & Co Inc down 4.4 percent to $26.81 on speculation its Zetia cholesterol drug fared poorly in a clinical trial comparing it to a drug from Abbott Laboratories.

Energy shares rose, with the S&P energy index <.GSPE> up 1.7 percent, even as crude oil futures declined. Oil giant Chevron Corp , up nearly 1 percent, is expected to report interim quarterly results later Thursday.

The rise in commodity-related shares reflected traders moving in and out of industry sectors, said Bruce Bittles, chief investment strategist at Robert W. Baird & Co in Nashville, Tennessee.

They were down a lot in the past weeks, particularly metals and energy, he said.

He expects buying to pick up. Maybe it's going to take a few more earnings reports to get that underway, but that's what I think should happen, said Bittles.

The Dow Jones industrial average <.DJI> dropped 4.61 points, or 0.06 percent, to 8,173.80. The Standard & Poor's 500 Index <.SPX> rose 3.16 points, or 0.36 percent, to 882.72. The Nasdaq Composite Index <.IXIC> gained 8.79 points, or 0.50 percent, to 1,755.96.

June sales fell at many retailers as the weak economy and cool, rainy weather dashed interest in summer shopping, further hampering hopes of growth in an economy so dependent on consumer spending.

But shares of Target Corp added 3.7 percent to $38.63, even as June same-store sales fell. The retailer said quarterly profit would meet or beat expectations.

The S&P 500 has rallied nearly 40 percent from its 12-year low set in early March on expectations that the economy would rebound from a deep recession. The rally has wilted lately as investors seek hard evidence of that recovery.

Results from a 30-year bond Treasury auction, expected at 1 p.m. EDT, will provide further insight into the government's ability to finance spending.

(Reporting by Rodrigo Campos and Leah Schnurr; editing by Jeffrey Benkoe)