U.S. stocks rose on Wednesday on signs of improved Midwest business activity and bargain-hunting a day after the S&P 500 fell to an eight-month low.

Energy and industrial shares, the hardest hit sectors on Tuesday, accounted for the bulk of Wednesday's gains. Manufacturer 3M shares rose 1.7 percent to $79.81 and Chevron added 0.6 percent to $68.78.

But Wednesday's rebound didn't rescue stocks' poor second-quarter performance. On the final trading day, major indexes were on track for their worst quarter in at least five.

You're getting a brief rally from yesterday's devastation, said Jim Awad, managing director at Zephyr Management in New York.

This quarter was a legitimate reaction to increasing concerns of a slowdown in the rate of recovery in the second half of 2010, he said.

The Dow Jones industrial average <.DJI> rose 27.70 points, or 0.28 percent, to 9,898.00. The Standard & Poor's 500 Index <.SPX> added 5.77 points, or 0.55 percent, to 1,047.01. The Nasdaq Composite Index <.IXIC> gained 15.48 points, or 0.72 percent, to 2,150.66.

For the quarter, the S&P is down 10.5 percent, the Dow has fallen 8.8 percent and the Nasdaq has lost 10.3 percent.

Wall Street rose on data showing Midwest business activity grew slightly more than expected in June, helping to offset a weak report on private-sector employment.

Market sentiment also gained after the European Central Bank said European banks needed to borrow less than had been expected, easing concerns about how they would repay a large amount of emergency loans.

Shares of Ford Motor Co jumped 5.1 percent to $10.38 after the automaker said it was wiping $4 billion in debt off its balance sheet and also paying $255 million on previously deferred securities distributions.

Monsanto Co , the world's largest seed producer, reported a 45 percent drop in quarterly net income, saying its Roundup herbicide business continued to struggle. Its shares fell 1.1 percent to $46.82.

(Editing by Kenneth Barry)