Stocks extended gains on Wednesday on better-than-expected earnings and government data that suggested companies may start to rebuild inventories, even as the economy shrank more than expected in the first quarter.

On the earnings front, Time Warner Inc and Qwest Communications International Inc provided a lift after reporting better-than-expected results.

Government data showed gross domestic product dropped more than expected, but a decline in inventories was good news as it suggested manufacturers and retailers had reduced the stock of unsold merchandise, which could be key in pulling the economy out of recession.

What everybody is hanging their hat on is this inventory draw, and the expectation that inventories are that far down that the next thing that's going to happen is that you're going to have to build inventories and we're going to have start manufacturing, said Paul Nolte at Hinsdale Associates in Hinsdale Illinois.

The expectation is this is the worst and things get better from here because we will start to rebuild inventories.

Investors are also awaiting comments from the U.S. Federal Reserve on the state of the economy and are hopeful for signs the recession is abating.

Analysts said worries about the impact of the spread of swine flu on the economy were easing, even as a baby in Texas who died of the new flu strain was the first confirmed death outside Mexico. A Houston health official said the 23-month-old was Mexican and was in the United States for medical treatment.

The Dow Jones industrial average <.DJI> gained 167.98 points, or 2.10 percent, to 8,184.93. The Standard & Poor's 500 Index <.SPX> climbed 18.59 points, or 2.17 percent, to 873.75. The Nasdaq Composite Index <.IXIC> rose 39.47 points, or 2.36 percent, to 1,713.28.

Shares of Time Warner rose 7 percent to $23.30 after the media group posted flat first-quarter profit, but its revenue decline was smaller than expected.

Qwest gained 6 percent to $3.78 after the telecommunications company posted better-than-expected results amid cost cutting.

Diversified manufacturer United Technologies Corp was the Dow's biggest lift, up 3.3 percent to $49.51.

The Fed will make a statement in the afternoon at the end of its two-day policy meeting, and economists expect it to hold its target range for its benchmark funds rate steady at near zero, as it has since December.

Bank of America Corp is holding its annual shareholder meeting in North Carolina on Wednesday amid media reports it may have to raise more capital.

Shareholders are voting on whether Chief Executive Kenneth Lewis should stay on the board, and whether he should give up his job as chairman. Shares of the bank were up 6 percent to $8.63.

The Wall Street Journal reported Lewis may be forced to relinquish the chairmanship but is set to win re-election to the bank's board by a wide margin.

(Reporting by Leah Schnurr; additional reporting by Edward Krudy; editing by Jeffrey Benkoe)