Investors sidestepped some of their doubts about the economy and bought energy and industrial stocks as commodity prices rose.
Stocks ended back-and-forth trading mostly higher Tuesday as a spike in the price of gold and corporate dealmaking extended an advance from Monday. The gains in commodity prices helped stocks pare early losses.
The Dow Jones industrial average slipped 17 points, while broader indexes rose modestly.
Investors were encouraged by billionaire investor Warren Buffett's decision to pay $34 billion for the railroad Burlington Northern Santa Fe in what he termed an "all-in wager" on the future of the U.S. economy. Meanwhile, tool maker Stanley Works struck a deal to acquire Black & Decker Corp. for $3.46 billion in stock.
Investors also took cues from commodities including gold, which jumped to a new high after India's central bank bought $6.7 billion worth of the metal from the International Monetary Fund.
Still, even with the gains in commodities, traders remained on edge about unemployment and the strength of an economic recovery.
Concerns about unemployment grew after health care products maker Johnson & Johnson said it would cut up to 7 percent of its global work force and streamline its business structure to save up to $900 million next year. Investors worry high unemployment will make it hard for the economy to sustain recent growth.
Financial stocks fell after the British government injected more money into Royal Bank of Scotland PLC and Lloyds Group PLC. That fanned worries about the troubles with bad debt still facing many banks.
Traders have been uneasy in recent weeks, wary about whether the economic recovery can maintain its third-quarter growth once government stimulus measures are removed. The Commerce Department said last week the economy grew at an annual rate of 3.5 percent during the summer.
The uncertainty about the economy has led to swings in the market. The Dow has risen or fallen more than 100 points in six of the last eight trading days, the most volatility since March.
Analysts said a break in the advance could ease worries that the market has advanced too quickly.
"This is a much-needed healthy pause and reassessment. It ran so far," said David Darst, chief investment strategist for Morgan Stanley Smith Barney in New York.
The Dow fell 17.53, or 0.2 percent, to 9,771.91, after being down as much as 86 points. The Dow rose 77 points Monday following reports of improvements in manufacturing and housing.