Stocks fell sharply on Wednesday after weaker manufacturing data from China and a gloomier growth outlook from the Federal Reserve heightened fears of a lackluster global economic recovery.

All S&P sector indexes were lower, with commodities and energy leading the way down as data in China pointed to lower consumption of raw materials and the International Energy Agency warned of risks to fuel demand if the global economy weakens.

The S&P materials sector index <.GSPM> was off 2.8 percent and the energy sector index <.GSPE> was down 2.6 percent.

Investors fled from riskier assets to safe-haven investments like the dollar and lower-risk government debt. U.S. 2-year Treasury note yields hit a record low.

Defensive stocks such as utilities and telecom held up better, with losses on the S&P utilities index <.GSPU> limited to 1.5 percent. That move and a strong demand in bonds, are forecasting a major slowdown in the economy, said Ryan Detrick, senior technical strategist at Schaffer's Investment Research.

The U.S. dollar rose 1.8 percent against a basket of major currencies <.DXY>.

The Dow Jones industrial average <.DJI> was down 180.58 points, or 1.70 percent, at 10,463.67. The Standard & Poor's 500 Index <.SPX> was down 21.56 points, or 1.92 percent, at 1,099.50. The Nasdaq Composite Index <.IXIC> was down 50.31 points, or 2.21 percent, at 2,226.86.

China reported a slowdown in factory output, adding to the picture of softening domestic demand painted by other data a day earlier that showed a sharp drop in import growth.

The U.S. trade deficit widened a surprising 18.8 percent in June, its highest since October 2008, a government report showed on Wednesday.

On Tuesday the Federal Reserve downgraded its outlook on the economy and said it would begin funneling proceeds from maturing mortgage bonds it holds into longer-term government debt to keep borrowing costs low.

But a tepid response in stocks suggested investors didn't see the actions as having much immediate impact on the weak labor market and slowing consumer spending, two headwinds facing the recovery.

Cisco Systems , which is due to report earnings after the bell, was the biggest decliner on the Dow, falling 2.7 percent to $23.64.

Alcoa Inc fell 2.5 percent at $11.07.

But Macy's Inc shares rose 3.9 percent to $20.12 following better-than-expected quarterly results.

(Editing by Padraic Cassidy)