U.S. Stocks seesawed on Wednesday, closing in the green after forecasts of an economic recession drove investors into sectors seen as resistant to the looming economic contraction, such as health care and consumer companies.

Global investment bank, Goldman Sachs added to existing concerns of a looming recession by forecasting the U.S. real gross domestic product would contract by 1 percent on an annualized basis in the second and third quarters.

Countrywide Financial Corp, the largest U.S. mortgage lender, said foreclosures and late payments rose in December to the highest on record. Countrywide shares fell 9.14 percent to $4.97. In five straight days of declines, the stock has lost 59.7 percent of its value.

Investors bought defensive stocks including drug makers such as Merck & Co, gaining 1.2 percent to $60.36 and Pfizer Inc, up 1.5 to $23.83. Consumer stocks rose steadily with the world's No. 1 soft drink maker, Coca Cola Co gaining 2 percent to $64.84 and McDonalds Corp. rising 0.2 percent to $57.19.

The Dow Jones industrial average was up 128.27 points, or 1.02 percent, at 12,717.34. The Standard & Poor's 500 Index was up 15.03 points, or 1.08 percent, at 1,405.22. The Nasdaq Composite Index was up 26.97 points, or 1.11 percent, at 2,467.48.