The major indexes advanced more than 1 percent, reversing Tuesday's slide in which energy shares had tumbled. Stocks have struggled to build upward momentum since reaching a 19-month high on April 23, with the S&P 500 climbing from recent support at 1,060.
Data showed pending sales of previously owned homes increased to a six-month high in April, though analysts pointed to a rush to take advantage of the home buyer's tax credit before it expired.
Investors seized on the housing data as a reason to get back into the market.
The fact that the market is reacting to a data point that some people feel deserves a pretty big footnote is indicative of a market that does seem to be skewed to the oversold side, said Craig Peckham, equity trading strategist at Jefferies & Company in New York.
The Dow Jones industrial average <.DJI> rose 107.62 points, or 1.07 percent, to 10,131.64. The Standard & Poor's 500 Index <.SPX> gained 14.27 points, or 1.33 percent, to 1,084.98. The Nasdaq Composite Index <.IXIC> climbed 32.03 points, or 1.44 percent, to 2,254.36.
In company news, Ford Motor Co said its U.S. sales rose in May for all brands from a year earlier and announced an increase in its second-quarter North American production plan, sending its stock up 2.5 percent at $11.70.
The Dow Jones U.S. Home Construction index <.DJUSHB> rose 2 percent and KB Home gained 2.3 percent to $14.04.
Energy shares were among the best performing stocks, recovering from Tuesday's losses while BP Plc embarked on its latest effort to halt the oil spill in the Gulf of Mexico. Even so, the plan hit a snag as BP attempted to cut away what is left of the well's riser pipe.
U.S.-listed shares of BP climbed 1.9 percent to $37.21 but since the rig explosion on April 20, the shares have lost more than 38 percent.
The PHLX Oil Service Sector index <.OSX> climbed 4 percent as Halliburton Co jumped 11.5 percent to $23.57 and Schlumberger Ltd advanced 7.9 percent to $55.85.
While there's still investor caution over the outlook for the stocks, the genuine blood bath in the sector yesterday certainly seems to have drawn in some fundamental value seekers, said Peckham.
Also giving the energy sector a lift was a 1.3 percent gain in oil prices to $73.55 a barrel. The S&P energy index <.GSPE> rose 2.8 percent.
Amgen Inc helped boost the Nasdaq, gaining 8.4 percent to $55.03 after the U.S. Food and Drug Administration approved its osteoporosis drug.
(Reporting by Leah Schnurr; Editing by Kenneth Barry)