The turnaround came as bank stocks rallied in response to comments by Rep. Barney Frank. The Massachusetts Democrat indicated Congress may pass a mild version of the financial overhaul bill that lawmakers are now negotiating.
While the market's comeback was impressive, it is still vulnerable to sharp drops on concerns about Europe's debt problems.
The Dow Jones industrials closed with a loss of 22, or 0.2 percent, at 10,043. The Standard & Poor's 500 index rose less than a point, or less than 0.1 percent, to 1,074. The Nasdaq composite index closed down 2, or 0.1 percent, at 2,210.
About three stocks fell for every two that rose on the New York Stock Exchange. Volume came to 1.9 billion shares.
Besides the financial crisis in Europe, investors were reminded that political issues, such as tension between North and South Korea, can threaten economic growth. Analysts said the unresolved Gulf of Mexico oil spill contributed to the foul mood.
But uncertainty over how Europe's debt problems will affect the rest of the world in the coming months remains the biggest source of investor pessimism, said Jonathan Corpina, president of Meridian Equity Partners.
The largest concern is that austerity measures that European governments are being forced to take could lead to a prolonged economic slump in the region and cause another global recession. He said investors fear that even those measures won't be enough.
"It seems like the Europeans are playing 'tag, you're it' first it was Greece, and now it's maybe Spain or Portugal," said Corpina, a New York Stock Exchange floor trader. "We know someone else is next. The problem is that it seems like every plan in place isn't going to satisfy the needs."
Britain's Queen Elizabeth opened Parliament with a warning of hard times, saying in a speech on behalf of Britain's new government that there would be budget cuts because "the first priority is to reduce the deficit and restore economic growth."
Other European countries are imposing budget cuts as well, trying to control their debt. Investors are concerned that these steps will stifle economic growth, and that the growth of other countries, including the U.S., will inevitably be stunted.
European Union leaders warned Tuesday that the continent's economy would stagnate unless governments make major reforms to promote growth. The problem is that large debts in some countries make it difficult to implement stimulus measures to rally economies.
The stock market turned so pessimistic in recent weeks that it doesn't take much to send the market several hundred points lower. Although it managed a comeback late Tuesday, no one believed the market's turbulence was over.