Stocks climbed on Tuesday as optimism that new aid for Greece was on the horizon lifted the euro against the dollar, overshadowing another round of weaker-than-expected U.S. economic data.

Rising expectations for a second aid package sent oil higher, with U.S. crude futures up 2 percent to $102.48 a barrel. Exxon Mobil Corp added 1 percent to $83.47, and Chevron Corp gained 1.4 percent to $104.60. The S&P energy index <.GSPE> climbed 1 percent.

The firming of the euro helped lift metals prices, with copper rising to a four-week high. Mining company Freeport-McMoRan Copper & Gold Inc edged up 0.5 percent to $51.96.

With May almost in the books, the S&P 500 is off 1.5 percent for the month. The benchmark index is on track for the worst monthly performance since August 2010 after a string of soft economic data raised doubts about the health of the economic recovery.

European officials were mulling options for a second bailout package for Greece, with private sector participation still under discussion. Germany, which was resisting extra funding, may drop its push for an early rescheduling of Greek bonds, the Wall Street Journal reported.

If Germany wants to pay the debt for them, I guess that works. I don't know how much longer that can continue, said Stephen Massocca, managing director at Wedbush Morgan in San Francisco.

The market has been down for a long time. We were down 4 weeks in row, we were due for a bounce. Any story is going to do it. The line of least resistance is higher here.

The Dow Jones industrial average <.DJI> gained 71.18 points, or 0.57 percent, to 12,512.76. The Standard & Poor's 500 Index <.SPX> rose 6.08 points, or 0.46 percent, to 1,337.18. The Nasdaq Composite Index <.IXIC> added 11.90 points, or 0.43 percent, to 2,808.76.

In the latest economic data, U.S. single-family home prices dropped in March, dipping below their 2009 low. The housing market remained bogged down by an inventory surplus and weak demand, according to the S&P/Case-Shiller composite index of 20 metropolitan areas.

Also, the Conference Board said its index of consumer attitudes fell in May on increased pessimism over the labor market and inflation worries.

The Institute of Supply Management-Chicago said business activity in the U.S. Midwest grew much less than expected in May.

(Reporting by Chuck Mikolajczak; editing by Jeffrey Benkoe)