NEW YORK — Stocks advanced in the final hour of trading Thursday following a sharp drop in oil and a warning from Citigroup Inc. that a "substantial" amount of write-downs on bad debt are still to come.

While much of the session saw the major indexes drift in and out of positive territory, the pullback in oil after China said it would raise price caps seemed to help stanch some of the selling that followed release of mixed economic readings.

While the decline in oil didn't go so far as to embolden investors after several days of selling, the drop did seem to douse some unease over the well-being of businesses and consumers hard hit by surging energy costs.

The comments from Citi's chief financial officer, Gary Crittenden, sent Citigroup shares lower and at times weighed on the financial sector. Citi was among the steepest decliners of the 30 stocks that make up the Dow Jones industrial average.

But while Citi's comments about faltering debt renewed worries about credit markets, the drop in oil seemed to encourage some investors to buying stocks.

Crude oil futures fell $4.75 to settle at $131.93 per barrel on the New York Mercantile Exchange after China disclosed plans to raise prices for gasoline and diesel fuel by 16 percent and 18 percent, respectively. The move could dampen demand.

"It really seems to be a tug-of-war between the good news and the bad news, or the not-as-bad news and the terrible news," said Jennifer Ellison, principal with wealth management firm Bingham, Osborn & Scarborough in San Francisco. "I think it's going to be hard for the market to find a trend when there is still this undercurrent of bad economic data and negativity in the financial sector and the high price of oil."

In late afternoon trading, the Dow rose 52.67, or 0.44 percent, to 12,081.73. The Dow fell below the 12,000 mark in Wednesday's trading for the first time since mid-March. The blue chips finished above that level, however.

Broader stock measures also advanced. The Standard & Poor's 500 index rose 6.14, or 0.46 percent, to 1,343.95, and the Nasdaq composite index jumped 29.46, or 1.21 percent, to 2,459.17.

Declining issues outnumbered advancers by about 8 to 7 on the New York Stock Exchange, where volume came to 1.06 billion shares.

Bond prices fell as stocks fluctuated. The yield on the benchmark 10-year Treasury note, which moves opposite its price, rose to 4.22 percent from 4.14 percent late Wednesday.

The dollar traded mixed against other major currencies, while gold prices rose.

Citigroup fell 28 cents to $20.12 after the company's comments about the likelihood of further write-offs of bad debt.

Circuit City Stores Inc. posted a first-quarter loss that was wider than last year's due to sinking sales at established stores. The electronics retailer also said it is suspending its dividend. The company's per-share loss was slightly smaller than analysts expected, but its revenue was lower. Circuit City fell 30 cents, or 7.4 percent, to $3.75.

Hexion Specialty Chemicals Inc. said it doesn't think it will be able to acquire fellow chemicals maker Huntsman Corp. because of the deterioration of Huntsman's finances. Huntsman fell $8.08, or 39 percent, to $12.78.

The Russell 2000 index of smaller companies rose 4.51, or 0.61 percent, to 735.18.

Overseas, Japan's Nikkei stock average sank 2.23 percent. Britain's FTSE 100 fell 0.84 percent, Germany's DAX index slipped 0.12 percent, and France's CAC-40 fell 0.59 percent.