The stock market ended slightly higher Wednesday as gains in shares of materials and technology companies offset concerns about mounting debt levels around the world.
The advance follows a day of back-and-forth trading Wednesday as investors grew cautious about rising government debt levels in Spain, Greece and other countries.
Investors have been looking for safety following a decision by credit rating agency Standard & Poor's to reduce the outlook on Spain's debt rating Wednesday.
S&P's move 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 debt 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 increase 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 drop 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."
Preliminary calculations showed, the Dow Jones industrial average rose 51.08, or 0.50 percent, to 10,337.05. The Standard & Poor's 500 index rose 3.95, or 0.36 percent, to 1,095.89, while the Nasdaq composite index rose 10.74, or 0.49 percent, to 2,183.73.
The ICE Futures US dollar index, which tracks the dollar against other major currencies, fell 0.3 percent.
Investors grew concerned that growing debt loads in countries like Greece and Spain as well as the U.S. and Britain could signal that the threat of defaults and higher borrowing costs could upend a nascent global economic rebound.
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 by 61.4 percent.
Not all the day's news was downbeat. The Commerce Department reported that businesses added to inventories at the wholesale level in October after a record 13 straight months of reductions. Investors hope it is a sign that businesses will soon start restocking store shelves. Wholesale inventories rose 0.3 percent in October; economists had expected a 0.5 percent drop.
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.
Tech and materials stocks posted some of the biggest gains. Apple Inc. rose $6.51, or 3.4 percent, to $196.38, while aluminum producer Alcoa Inc. rose 19 cents, or 1.5 percent, to $13.06.
Gold slid, while oil fell $1.95 to settle at $70.67 per barrel on the New York Mercantile Exchange.
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.