Stocks ended higher for the day on optimism over prospects of a Greek bailout package, despite several reports of economic weakness, but the gains weren't enough to erase a month of losses.
The Dow Jones Industrial Average fell 240.75 points in May or 1.9 percent to close at 12,569.79, snapping a five-month winning streak. For Tuesday, the blue chip average gained 128.21 points or 1 percent.
Most Dow components gained on Tuesday, with Intel among the lead performers. The chipmaker unveiled a new category of laptops its calling Ultrabooks at a trade show in Taiwan.
Cisco also climbed after the tech bellwether said it has collaborated with SAP to deliver enhanced business intelligence solutions for enterprises.
TheS&P 500 fell 18.41 points in May, or 1.35 percent, to close at 1,345.20. On Tuesday, the broad market index rose 14.10 points or 1 percent.
The Nasdaq fell 38.24 points in May, or 1.33 percent, to close at 2,835.30. On Tuesday, the tech-heavy index gained 38.44 points, or 1.4 percent.
The CBOE Volatility Index, widely considered the best gauge of fear in the market, rose 4.75 percent in May to 15.45.
Some of the worst performers for May were global industrial firms, including Cummins , which fell 12.4 percent, Deere , which fell 11.7 percent, and Caterpillar , which fell 8.3 percent.
Caterpillar was also the worst performing Dow stock for the month, accounting for 30 percent of the blue chip average's losses.
Defensive sectors did best in May. Consumer staples rose 2.4 percent, utilities rose 1.6 percent and health care rose 1.6 percent.
Stocks initially got a boost on Tuesday from news some officials in Germany will allow Greece to restructure its debt.
That news also pushed the euro to a three-week high against the dollar and oil prices also gained. U.S. light, sweet crude rose 2 percent Tuesday to $102.70 a barrel; for the month, sweet crude fell 9.86 percent. In London, Brent crude climbed 1.79 percent to $116.73. For the month, Brent fell 7.28 percent.
Precious metals fell, as gold 0.03 percent to settle at $1,535.90 an ounce. For the month, gold fell 1.29 percent. Silver rose slightly on Tuesday to settle at $38.30 an ounce, but fell more than 21 percent for the month.
The brighter performance for stocks on the last day of the month is unlikely to turn around the market's negative performance in May. As of Friday, the Dow was down nearly 3 percent, the S&P 500 was down 2.4 percent, and the Nasdaq was down 2.7 percent. All major indices remain higher for the year, however.
If history is a guide, stocks won't turn around in June. The Dow has fallen for the last six Junes, and has been up only twice since 2000. Overall, the market has been down in June in the last four years.