Then the market soared in the final hour after JPMorgan Chase, the country's largest bank by assets, announced that it plans to buy back as much as $15 billion of its stock and raise its quarterly dividend by a nickel to 30 cents per share.
"That's what really made the day," said Jeffrey Kleintop, chief market strategist at LPL Financial.
JPMorgan Chase stock gained 7 percent, and other banks followed. Citigroup and Goldman Sachs gained 6 percent. Banks were easily the best-performing stocks in the market, gaining almost 4 percent as a group.
The announcement came just before the Fed made a surprise announcement of the results of its annual stress test for banks. JPMorgan Chase and 14 other financial institutions passed. Four, including Citigroup, failed.
The Fed had planned to release the results on Thursday. But it moved up the announcement after JPMorgan declared its dividend increase. The bank said it had the Fed's blessing to raise the dividend.
Citigroup stock was down 4 percent in after-hours trading following the Fed announcement.
The Dow finished at 13,177.68, its highest close since the last day of 2007. The close put the Dow within 1,000 points of its record, 14,164.53, set less than three months earlier.
All 30 stocks in the Dow closed higher.
The Nasdaq composite index rose 56.22 points, or 1.9 percent, to 3,039.88. The last time the Nasdaq closed above 3,000, it was on its way down fast. The index peaked above 5,000 in March 2000 and bottomed just above 1,100 two and a half years later.
Jack Ablin, chief investment officer at Harris Private Bank, said the key difference between the Nasdaq then and now is that the technology companies that dominate the index promised only profits 12 years ago.
Today those profits are real, and massive. The Nasdaq's largest companies are Apple, Microsoft and Google.
The Standard & Poor's 500 index closed up 24.87 points, or 1.8 percent, at 1,395.96, its highest level since June 5, 2008. The S&P has gained 11 percent since Jan. 1, more than what it posts in an average year.
Brian Gendreau, market strategist at Cetera Financial, said stocks could still go higher. Investors are paying roughly 13 times the past year's earnings for the S&P 500 index. The long-term average is closer to 15.
"Valuations are still very cheap," he said.
The dollar rose against the euro and hit an 11-month high against the Japanese yen after the Federal Reserve assessment. The euro fell to $1.3073 late Tuesday from $1.3150 late Monday. The dollar soared to 83.08 yen from 82.26 late Monday.
The retail sales report showed a gain of 1.1 percent last month. Some of it reflected higher gas prices, but Americans also spent more on cars, clothes and appliances. Department stores had their biggest gains in more than a year. The government also revised its estimates higher for December and January.
A reading of confidence among small business owners also rose in February for the sixth month in a row. The National Federation of Independent Business optimism index reached its highest level in a year, helped by an increase in expected sales.
The rally gained strength in the afternoon when the Federal Reserve said it saw signs of an improving economy and expected the unemployment rate to keep falling. The Fed also said strains in the global financial markets have eased.
Among companies making big moves:
Great Wolf Resorts jumped 27 percent to $5.13. Apollo Global Management said it has agreed to buy the indoor water park operator for $5 a share.
Urban Outfitters dropped 5.3 percent, the worst drop in the S&P 500 index. The retailer reported earnings that fell below what analysts were expecting after it had to mark down prices on women's clothing at its Anthropologie and Urban Outfitters stores.
Carmike Cinemas soared 17 percent. The Georgia-based movie theater chain reported earnings and sales that far outpaced what Wall Street analysts had expected.