Uneasy investors sold stocks mostly lower Tuesday as oil prices climbed above $51 per barrel, creating new worries that rising energy costs would curb consumer spending and corporate profits. Only the Nasdaq composite index managed a small gain.

The major indexes did not see a major oil-based sell-off, as they had in the past, as crude futures posted a new record closing price. A barrel of light crude closed at $51.09, up $1.18, on the New York Mercantile Exchange, after reaching a new intraday record high of $51.29. Nonetheless, rising energy prices made investors anxious enough that they decided to collect profits after the market's substantial gains in four of the last five sessions.

"We're now talking about higher energy prices through the winter months, and futures for December and January have moved up quite dramatically," said Chris Wolfe, global head of equities for J.P. Morgan Private Bank. "What that suggests is that maybe this is a longer break on the economy's growth than we've been anticipating."

The Dow Jones industrial average fell 38.86, or 0.4 percent, to 10,177.68. The Standard & Poor's 500-stock index slipped 0.69, or 0.1 percent, to 1134.48, and the Nasdaq composite index gained 3.10, or 0.2 percent, to 1955.50.

Technology stocks fell as Advanced Micro Devices, Intel's rival in computer semiconductors, warned that its revenue would be less than forecast for the third quarter. AMD slid 2 cents, to $13.68, while Intel gained 19 cents, to $21.32.

A pair of technology bellwethers and Dow components were affected by a J.P. Morgan Securities research note, which upgraded International Business Machines to "overweight" from "neutral," while downgrading Hewlett-Packard to "neutral" from "overweight." IBM gained 16 cents, to $87.32, while H-P fell 8 cents, to $18.98.

Eastman Kodak rose 31 cents, to $33.80, after it announced it will cut nearly 900 jobs at three manufacturing facilities in Europe, part of the company's transition from film to digital photography.

Chiron, maker of half the U.S. supply of flu vaccines, cut its profit outlook for the year after the British government pulled the company's manufacturing license. Chiron tumbled $7.44, or 16.4 percent, to $37.98.

Other Indicators

* The New York Stock Exchange composite index rose 1.50, to 6679.25; the American Stock Exchange index rose 10.34, to 1286.68; and the Russell 2000 index of smaller-company stocks fell 1.75, to 587.34.

* Declining issues narrowly outnumbered advancing ones on the NYSE, where trading volume fell to 1.42 billion shares, from 1.53 billion on Monday. On the Nasdaq Stock Market, decliners outnumbered advancers by 11 to 9 and volume totaled 1.7 billion, down from 1.83 billion.

* The price of the Treasury's 10-year note fell 31 cents per $1,000 invested, and its yield rose to 4.18 percent, from 4.17 percent on Monday.

* The dollar rose against the Japanese yen and fell against the euro. In late New York trading, a dollar bought 111.09 yen, up from 110.87 late Monday, and a euro bought $1.2327, up from $1.2287.

* Gold for current delivery rose to $418.20 a troy ounce, from $414.00 on Monday, on the New York Mercantile Exchange's Commodity Exchange.