Stocks rallied on Wednesday, led by tech and homebuilding stocks, as investors awaited a key announcement by the Federal Reserve.

The major averages were all up more than 1 percent, rebounding from Tuesday's sell-off, when the S&P 500 suffered its steepest one-day decline in five weeks.

There's a little bit of bargain hunting going on, said Rob Stein, managing partner at Astor Asset Management. People are worried they're going to miss a rally so they're buying after a couple of days down.

Chipmaker Applied Materials and luxury homebuilder Toll Brothers drove gains in their respective sectors after both issued positive outlooks.

The market advance had been more muted earlier in the day, ahead of the close of Fed's two-day policy meeting.

The Fed's monetary policy committee is expected to leave the U.S. central bank's key target interest rate unchanged, but investors will study the Fed's policy statement, due at around 2:15 p.m. EDT, for any changes in its outlook or its ongoing efforts to keep rates low through purchases of Treasury and mortgage debt.

The Fed is going to talk up the economy because it's important for them to keep the momentum going, said Jim Awad, managing director at Zephyr Management in New York. They'll give a nod to the inflation hawks that they'll withdraw some of the stimulus at the appropriate time, but now is not the time. They won't change their balance programs.

The Dow Jones industrial average <.DJI> was up 114.49 points, or 1.22 percent, at 9,354.43. The Standard & Poor's 500 Index <.SPX> was up 11.43 points, or 1.15 percent, at 1,005.78. The Nasdaq Composite Index <.IXIC> was up 31.01 points, or 1.57 percent, at 2,000.72.

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

Applied Materials said it would at least break-even in the fourth quarter, thanks to new orders and cost cuts, while Toll Brothers said that for the first time in 16 quarters, the number of net signed contracts exceeded year-ago figures.

Shares of Applied Materials advanced 3.6 percent to $13.70, leading the Philadelphia Semiconductor index <.SOXX> up 1.9 percent to 296.24. Toll Brothers surged 13 percent to $23.15 and lifted the Dow Jones U.S. Home Construction index <.DJUSHB> 4.3 percent to 291.97.

Macy's Inc rose 3.6 percent to $16.01 after it posted better-than-expected earnings and raised its outlook.

Also Wednesday, the Commerce Department said the U.S. trade deficit widened less than expected in June on gains in exports, which were spurred by a pick-up in global demand. The gap increased 4 percent to $27 billion from $26 billion in May.

(Editing by Leslie Adler)