Stocks rose on Wednesday as investors turned to financial stocks following factory and home sales data that showed the economic slump could be moderating.

Factory activity in March shrank at a slower pace than the month before, while pending sales of existing homes rose in February amid a continuing decline in prices.

The data more than offset negative sentiment arising from a report showing job losses in the private sector accelerated in March, as well as fears that struggling automaker General Motors could be headed for bankruptcy.

Financial shares turned around following the manufacturing and homes data, on bets an improvement in the economic outlook will boost financial activity, with JPMorgan Chase up 4.6 percent at $27.79 while Bank of America gained 4.3 percent to $7.10.

The S&P financials index <.GSPF> added 2.6 percent.

Because we fell off a cliff, you need to get a lot of diverse areas telling us it's not as bad this month as it was last month and that's what's happening, said Linda Duessel, market strategist at Federated Investors in Pittsburgh.

They're all little, but there's ever-increasing numbers of them.

The Dow Jones industrial average <.DJI> gained 118.67 points, or 1.56 percent, to 7,727.59. The Standard & Poor's 500 Index <.SPX> rose 10.31 points, or 1.29 percent, to 808.18. The Nasdaq Composite Index <.IXIC> added 19.46 points, or 1.27 percent, to 1,548.05.

The S&P 500 gained about 19 percent from 12-year lows hit in early March and on Tuesday closed out its best month since October 2002. The rally has been fueled by hopes that the economy is showing signs of stabilization.

Shares of homebuilders were among the top gainers for the day following the home sales data, with Centex Corp up 6.9 percent at $8.02 and Lennar Corp up 2.3 percent at $7.68. The Dow Jones home construction index <.DJUSHB> gained 4.5 percent.

Overall gains were kept in check, however, by steep declines in the health-care sector. Celgene Corp was among the heaviest weights, falling 16 percent to a fresh 52-week low at $37.25 after the biotechnology company forecast first-quarter earnings below estimates, prompting at least four brokerages to cut their price target on the stock. Celgene was the top drag on the Nasdaq.

The S&P health-care index <.GSPA> fell 0.9 percent and the sector was the session's worst performer.

Shares of General Motors fell 5.7 percent to $1.83 following a New York Times report that the Obama administration is seeking to ease GM into a controlled bankruptcy, but a senior official said the White House remains optimistic that GM can restructure without going to bankruptcy court.

Market watchers were also focused on the Group of 20 summit in London as leaders of the world's top economies meet to tackle the global economic crisis.

(Additional reporting by Edward Krudy; Editing by Jan Paschal)