The rally was remarkably fast -- the Dow Jones industrial average was still down for the day with less than an hour of trading to go -- and enough to erase two-thirds of its decline the day before.
The Fed set its target for interest rates near zero in 2008 as a response to the financial crisis that fall. Since then, it had said only that rates would stay low for an "extended period." On Tuesday, it said that would be at least through mid-2013.
But the Fed also said it expects the economy to stay weak for two more years, longer than the Fed had previously indicated. It has already been more than two years since the end of the Great Recession.
The central bank left open the possibility of a third round of bond purchases designed to hold interest rates down and push stock prices up. The second round, announced last year, sparked a 28 percent rally in the Dow through April 29.
It was an unusually volatile day of trading. The Dow was up about 200 points most of the morning. It was up about 100 when the Fed statement came out at 2:15 p.m. Within half an hour, the Dow was down more than 200.
But investors warmed to the Fed news, and the Dow made a bumpy, steep climb for the final stretch of trading. That included a 640-point swing from its lowest point of the day to its highest.
The yield on the 10-year Treasury bond briefly hit a record low, 2.03 percent, and finished at 2.26 percent. Investors have bought U.S. debt, driving yields down, even after S&P stripped the United States of its top-of-the-line credit rating last week.
Interest rates on consumer loans, including adjustable-rate mortgages, car loans and credit cards, are often based on Treasury rates. So mortgage rates, which are already among the lowest ever, could go even lower.
Low interest rates for two more years could make the stock market a better bet because bonds will return less money. That appeared to be at least part of the reason stocks rallied so much after investors had a chance to digest the Fed's statement.
Some analysts also attributed the late-day rally to wording in the Fed's statement suggesting it might take further steps to stimulate the economy in the future.
The stock rally came after two and a half weeks of almost uninterrupted declines. Those were fueled first by uncertainty about the federal debt ceiling, then by concerns that the U.S. economy is headed for a new recession and about out-of-control European debt.
When it came late Friday, the downgrade only added anxiety. On Monday, the first day of trading after it was announced, the Dow fell 634 points. Even counting Tuesday's gains, the Dow is down 11.6 percent since July 21 -- almost 1,500 points.
The price of gold continued its seemingly unstoppable climb. It set a record price of $1,782 an ounce. Some investors see gold as a safe bet because its value isn't tied to a particular nation, like a currency or government bonds, or to companies, like stocks. The price of gold has more than doubled since the recession began in 2007.
The Fed's announcement of a two-year timeframe for any rate increase underscored a stark reality: A sluggish economy and painfully high unemployment have become chronic.
"The tone of the Fed's statement is very downbeat. They are very nervous about the economy," said Mark Zandi, chief economist at Moody's Analytics. "This is unprecedented for the Fed to indicate they are ready to keep rates low for two more years."
Not everyone was as impressed as investors on Wall Street appeared to be. University of Oregon economist Timothy Duy called the move "weak medicine" and said he wanted to see the Fed commit to buying more Treasury bonds, a measure known as quantitative easing.
The Fed's projection of a weak economy into 2013 is also bad news for President Barack Obama, who must fight a re-election campaign next year. Already, some of Obama's Republican challengers have blamed the S&P downgrade on him. S&P itself blamed the country's long-term debt problems and dysfunctional politics.
Specifically, the Fed said the economy was "likely to warrant exceptionally low levels for the federal funds rate at least through mid-2013." It held out the promise of further help down the road but did not spell out what else it might do.
The central bank's decision was approved on a 7-3 vote with three Fed regional bank presidents who have been worried about inflation objecting. It was the first time since November 1992 that as many as three Fed members have dissented from a policy statement.
Dean Maki, chief U.S. economist at Barclays Capital, said the dissent suggests that Fed Chairman Ben Bernanke would have trouble building consensus for another round of bond purchases.
The Fed used significantly more downbeat language to describe current economic conditions. It said so far this year the economy has grown "considerably slower" than the Fed had expected and consumer spending "has flattened out."
It also said that temporary factors, such as high energy prices and the Japan crisis, only accounted for "some of the recent weakness" in economic activity.
Bob Doll, chief equity strategist for asset manager BlackRock, shrugged off worries that a slow-growing U.S. economy would weaken the corporate earnings that underlie stock prices.
"Corporate America has demonstrated that it can generate good growth and profits despite a weaker U.S. economy," he said.
Companies have earned healthy profits despite a weak economy by expanding in faster-growing markets overseas and by squeezing more work out of reduced staffs in the United States.
Doll said the low yields on bonds make stocks irresistible. He noted that the yield on 10-year Treasury bonds is now lower than the dividend yield on stocks in the S&P 500 index "for the first time in my career."
The more explicit timeframe on the Fed's key interest rate is aimed at calming nervous investors. It offered them a clearer picture of how long they will be able to obtain ultra-cheap credit.
Bernanke didn't speak publicly after Tuesday's Fed meeting. He is expected to speak later this month at the Fed's annual retreat in Jackson Hole, Wyo., Bernanke will likely address the weakening economy, the S&P downgrade and the market turmoil.