Stocks edged lower on Thursday, hurt by a slide in drugmaker Merck and as falling commodities prices hit shares of natural resource companies.

The S&P 500, however, held near 28-month highs as investors saw stocks' upward trend continuing, focusing on expectations for strong earnings.

Intel Corp's shares rose 1 percent after the close as investors digested the technology bellwether's results. Intel ended regular trading down slightly at $21.29 a share.

During Thursday's session copper prices retreated from recent highs on concerns of slowing demand from China. Freeport McMoRan Copper & Gold lost 3.1 percent to $118.07, and the S&P materials sector <.GSPM> fell 0.8 percent.

The fact the commodities market is trading down is what's putting pressure on materials shares, said Tom Schrader, managing director of U.S. equity trading at Stifel Nicolaus Capital Markets in Baltimore.

Merck & Co dropped 6.6 percent to $34.69, accounting for more than half the losses in the Dow, after it stopped giving a blood clot preventer, one of its most important experimental drugs, to some patients.

The S&P healthcare index <.GSPA> fell 0.54 percent.

Weekly initial jobless claims jumped to their highest level since October last week while food and energy costs lifted producer prices in December, pointing to headwinds for an economy that has shown fresh vigor.

A surge in exports to their highest level in two years helped narrow the U.S. trade deficit in November, an encouraging sign for positive surprises in the current earnings season.

The Dow Jones industrial average <.DJI> fell 23.54 points, or 0.20 percent, to 11,731.90. The Standard & Poor's 500 Index <.SPX> dropped 2.20 points, or 0.17 percent, to 1,283.76. The Nasdaq Composite Index <.IXIC> dipped 2.04 points, or 0.07 percent, to 2,735.29.

The benchmark S&P 500 has gained 22.3 percent since the start of September.

About 7.5 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq, below last year's estimated daily average of 8.47 billion.

Advancing stocks trailed declining ones on the NYSE by 1,363 to 1,622, while on the Nasdaq, more than 5 stocks fell for every four that rose.

JPMorgan fell 0.6 percent to $44.45 ahead of its results, expected before the market's open on Friday. Its shares have risen 4.8 percent so far this year.

Earnings from S&P 500 companies are expected to rise 32 percent in the fourth quarter compared to a year ago.

Marathon Oil Corp gained 6 percent to $42.98 after it said it would spin off its refinery and pipeline operations into a stand-alone company.

Easing recent worries about the credit crisis in Europe, Spain and Italy followed Portugal with successful debt sales on Thursday. The euro rose 1.7 percent against the U.S. dollar, its best day in six months.

(Reporting by Rodrigo Campos; additional reporting by Pedro Nicolaci da Costa; Editing by Kenneth Barry)