Stocks rose on Wednesday following factory and home sales data that may point to a healthier economy later in the year, boosting investor optimism.

Shares of big manufacturers Caterpillar Inc and US Steel Corp rose sharply after data showed factory activity in March fell at a slower rate than the month before, while pending sales of existing homes rose in February amid further price declines. The data more than offset negative sentiment due to a report showing job losses in the private sector accelerated in March, as well as fears that struggling automaker General Motors may be headed for bankruptcy.

Shares turned around following the manufacturing and homes data, with broad cross-sector buying benefiting shares of financial firms, homebuilders and natural resource companies.

In the financial sector, JPMorgan Chase rose 3.8 percent to $27.60 while Goldman Sachs gained 3.5 percent to $109.73.

I would describe it (Wednesday's economic data) as pretty

consistent with our outlook that first-quarter GDP is going to be extremely negative, but we'll get improvement thereafter, said Keith Hembre, chief economist at First American Funds in Minneapolis.

If we haven't seen the maximum decline in production activity to date, we should probably see it reasonably soon and look for production numbers to get better.

The Dow Jones industrial average <.DJI> gained 78.53 points, or 1.03 percent, to 7,687.45. The Standard & Poor's 500 Index <.SPX> added 6.25 points, or 0.78 percent, to 804.12. The Nasdaq Composite Index <.IXIC> rose 9.55 points, or 0.62 percent, to 1,538.14.

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

In the industrial sector, Caterpillar was up almost 4 percent at $29.01 and U.S. Steel was up 6.2 percent at $22.44.

Shares of homebuilders were among top gainers following the home sales data, with Centex Corp up 4.5 percent at $7.84. The Dow Jones home construction index <.DJUSHB> gained 2 percent.

But gains were kept in check by declines in the health-care sector after Celgene Corp 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, down 14.4 percent at $38.00. Earlier, Celgene hit a fresh 52-week low at $36.90. The S&P health-care index <.GSPA> fell nearly 1 percent; of the S&P's 10 sectors, this was the only sector in negative territory.

Shares of General Motors fell 6.7 percent to $1.81 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.

(Editing by Jan Paschal)