US stocks rose on Tuesday as signs Greece would stay in the euro zone were enough to spark buying in what has been a weak month for equities, while Facebook plumbed new lows on high volume.
Wall Street has swung back and forth on shifting signals coming out of Europe. More than three issues rose for every declining one on the New York Stock Exchange, supported by weekend polls favoring pro-bailout parties in the upcoming Greek election.
"There's so much negativity that any bit of good news is able to move the market higher," said Ryan Detrick, senior technical strategist at Schaeffer's Investment Research.
The S&P 500 is down nearly 5% in May, so far its worst monthly performance since September, with traders backing away as the euro zone crisis shows signs of worsening.
The market could remain on edge as the June 17 elections draw closer, as a rejection of the bailout plan could trigger a Greek exit from the euro zone and badly hurt the bloc's credit and economies.
Worries over Spain's banking system added to uncertainty. Madrid will soon issue new bonds to fund ailing lenders and indebted regions, despite borrowing costs rising towards the 7% level that drove other euro zone countries to seek a bailout.
Equity gains notwithstanding, the pressure on Spanish banks pulled the euro below $1.25, its lowest in nearly two years. Further dollar strength could bring commodity prices lower and hurt global stock markets.
The Dow Jones industrial average rose 125.86 points, or 1.01%, to 12,580.69. The S&P 500 Index added 14.60 points, or 1.11%, to 1,332.42. The Nasdaq Composite gained 33.46 points, or 1.18%, to 2,870.99.
Facebook Inc, the second-most traded stock in US exchanges on Tuesday, hit a new low of $28.65, down more than 10%, before closing off 9.6% at $28.84.
The stock was pressured partly by talk Facebook was in discussions to buy Oslo-based Opera Software. Analysts said competition from Google Inc and others could push the price tag of any deal with the mobile browser maker above $1 billion.
Homebuilder stocks rose after data showed US home prices rose for the second month in a row in March.
The PHLX housing sector index rose 2.5% and is up 25.4% year-to-date.
Vertex Pharmaceuticals Inc dropped 10.9% to $57.80 after the drugmaker released corrected data involving its cystic fibrosis treatments.