Investors set aside some of their concerns about rising debt levels around the world and looked for bargains after a two-day slide in stocks.
Stocks turned higher late Wednesday after trading erratically, and the Dow Jones industrials closed up 51 points. Investors have been cautious about rising government debt levels in Spain, Greece and other countries.
Investors started out looking for safety after Standard & Poor's reduced the outlook on Spain's debt rating. But analyst upgrades of manufacturing conglomerate 3M Co. and telecommunications company Sprint Nextel Corp. drew some buyers.
Concerns that troubled balance sheets have shifted from banks to governments have dogged investors for weeks. A warning from S&P about Spain came a day after another agency lowered its credit rating on Greece's government. Investors have been watchful for other signs of problems with global debt ever since a state-run company in Dubai shocked investors two weeks ago by asking its creditors for a reprieve.
Meanwhile, stocks again followed moves in the dollar, as they have for months. When it falls, the dollar makes commodities cheaper for foreign buyers and raises profits for U.S. companies that do business outside the U.S.
The dollar has steadied this week against other major currencies, interrupting a steady slide since March. The greenback has fallen as investors take advantage of cheap financing to invest in riskier, higher-yielding assets like stocks and commodities. Signs that the economy is improving have cut into demand for safe-haven investments.
In recent weeks, however, investors have been shuttling between buying stocks and hoarding cash as they try to lock in some of the big gains they've amassed in stocks since a rally started in March.
As the end of the year approaches, many investors have been building up defensive investments like Treasurys. The uncertain tone in the market, combined with light trading volume, has made for choppy trading, which analysts expect to continue through the rest of the year.
Tom Phillips, president of TS Phillips Investments in Oklahoma City, said he expects the dollar will lose its pull over the stock market because so many traders have placed bets that the currency will fall and boost stocks.
"When everybody understands the game the game doesn't work as well," he said. "I think it will just fray and start to erode."
The Dow rose 51.08, or 0.5 percent, to 10,337.05 after falling 104 on Tuesday. The Dow crossed cross the unchanged mark 59 times.
The broader S&P 500 index rose 4.01, or 0.4 percent, to 1,095.95, its first gain of the week. The Nasdaq composite index rose 10.74, or 0.5 percent, to 2,183.73.
The ICE Futures US dollar index, which tracks the dollar against other major currencies, fell 0.3 percent.
Investors have been reassessing their investment strategy this month as reports signal the economy is improving. While investors want to see the economy grow, they also know that the Federal Reserve could raise interest rates and remove other stimulus measures once the economy appears to be on solid footing. Higher rates could make stocks look less appealing as returns for other investments improve, potentially upsetting a nine-month advance in stocks that has lifted the S&P 500 index to a gain of 21.3 percent for 2009.
Hugh Johnson, chairman and chief investment officer of Johnson Illington Advisors in Albany, N.Y., said signs of improvement in the economy are disrupting advances in the markets because traders predict the Fed will be forced to raise interest rates sooner than expected to keep inflation in check.
The government reported Friday that employers cut the fewest jobs in November since the recession began two years ago. The figures were far better than expected and prompted a re-evaluation of where the Fed stands, despite comments from Fed Chairman Ben Bernanke that interest rates will remain low.
"That's going to be tough to defend," Johnson said, referring to the Fed's stance on rates. "That's why investors have started to rethink all of the things that have made money over the past nine months."
In other trading, Treasurys fell, sending yields higher. The yield on the benchmark 10-year Treasury note rose to 3.44 percent from 3.39 percent late Tuesday.
An analyst upgrade of 3M helped lift the Dow industrials a day after it dragged the index down when its profit forecast disappointed investors. 3M rose $2.63, or 3.4 percent, to $79.74.
Sprint Nextel rose 22 cents, or 5.6 percent, to $4.13 after an analyst raised his rating on the company.
Gold slid, while oil fell $1.95 to settle at $70.67 per barrel on the New York Mercantile Exchange.
The Russell 2000 index of smaller companies rose 0.33, or 0.1 percent, to 598.03.
Advancing stocks narrowly outpaced those that fell on the New York Stock Exchange, where consolidated volume to 4.2 billion shares compared with 4.8 billion Tuesday.
Overseas, Britain's FTSE 100 fell 0.4 percent, Germany's DAX index and France's CAC-40 each lost 0.7 percent. Japan's Nikkei stock average fell 1.3 percent.