U.S. stocks powered higher on Wednesday as the Federal Reserve said it saw signs of a more stable economy.

Stocks had been on track to close at their highest level in 10 months, led by technology and financials, but shares lost steam in the last half hour of trading.

The Federal Reserve said the economy was leveling out, and it left interest rates unchanged at the end of its two-day policy meeting.

The Fed also said it will extend the duration but not the size of a program to buy long-term government debt, which is part of its effort to revive credit and stimulate the economy.

The Fed admitted the economy is getting better, but not so much better we're going to be terminating all of our programs, which is what everybody was afraid of, said Doug Roberts, chief investment strategist at ChannelCapitalResearch.com in Shrewsbury, New Jersey.

Financials <.GSPF> was the top-performing sector on the S&P 500, up 2 percent, after a 3.5 percent slide on Tuesday. Allstate Corp rose 6.3 percent to $28.42 after Bank of America-Merrill Lynch upgraded the insurer to buy from neutral.

The Dow Jones industrial average <.DJI> gained 120.16 points, or 1.30 percent, to 9,361.61. The Standard & Poor's 500 Index <.SPX> rose 11.46 points, or 1.15 percent, to 1,005.81. The Nasdaq Composite Index <.IXIC> added 28.99 points, or 1.47 percent, to 1,998.72.

The S&P is up about 49 percent from its more than 12-year closing low set on March 9.

Shares of Applied Materials rose 3.3 percent to $13.66 after the maker of chip equipment said it would at least break even this year thanks to new orders and deep cost cuts. The PHLX semiconductor index <.SOXX> gained 1.8 percent.

Shares of luxury home builder Toll Brothers soared 14.4 percent to $23.42 after it said its net signed contracts rose in the third quarter, the first increase in four years. The Dow Jones home construction index <.DJUSHB> jumped 5 percent.

Shares of Macy's Inc rose 6 percent to $16.40 after the department store operator posted better-than-expected earnings and raising its outlook.

(Additional reporting by Leah Schnurr; Editing by Leslie Adler)