NEW YORK - The Federal Reserve surprised financial markets on Wednesday with a cautious outlook on the economy, pushing stocks and bonds sharply higher.

After wrapping up a two-day meeting, Fed policymakers left open the possibility of a rate increase later in the year, but also lowered the central bank's forecast for economic growth and noted that inflation would likely remain low.

Investors judged that the tentative tone stuck by policymakers meant that while rates may soon head higher, the pace of any increases will be more moderate than they had thought.

Stocks swung from losses earlier in the day to big gains after the Fed released its post-meeting statement. Bonds also rallied, pushing the yield on the 10-year Treasury note back below 2 percent. The dollar plunged against the euro.

"There is very little to suggest that the Fed is going to raise rates aggressively this year," said Jeremy Zirin, an investment strategist at UBS Wealth Management.

The Standard & Poor's 500 index rose 25.22 points, or 1.22 percent, to 2,099.50. The index had been down as much as 11 points before the release of the Fed's statement at 2 p.m.

The Dow Jones industrial average gained 227.11 points, or 1.27 percent, to 18,076.19. The Nasdaq composite rose 45.39 points, or 0.92 percent, to 4,982.83.

Energy companies led the gains for stocks as the price of oil spiked after the Fed's statement. Lower rates tend to make oil and other hard assets more attractive investments, increasing their prices. The energy sector in the S&P 500 jumped 2.9 percent.

Benchmark U.S. crude rose $1.20 to close at $44.66 a barrel in New York. Brent crude, a benchmark for international oils used by many U.S. refineries, rose $2.40 to close at $55.91 a barrel in London.

In currency trading, the dollar slumped, reversing a recent surge against the euro. The U.S. currency weakened almost 3 percent against the euro, to $1.0894. The dollar had traded as low as $1.05 earlier in the week.

Although the hiring picture in the United States has improved in recent months, other indicators have been weaker.

A report Monday showed that output at U.S. factories fell for a third straight month in February, driven by a big drop in production at auto plants. Retail sales have also remained sluggish despite a big drop in gas prices that has put more money in consumers' pockets.

"The Fed and the market have gotten a whole lot closer together," said Michael Arone, chief investment strategist for State Street Global Advisors.

Metals were mixed. Gold rose $3.10, or 0.3 percent, to $1,151.30 an ounce. Silver fell four cents, or 0.2 percent, to $15.54 an ounce. Copper dropped six cents, or 2.4 percent, to $2.57 a pound.