Stocks rose on Tuesday on optimism that more financial aid for Greece was imminent, but weaker-than-expected manufacturing and consumer confidence data underscored the doubts that have hit stocks this month.

Stocks jumped more than 1 percent at the open, but pared gains after the latest disappointing economic reports echoed recent lackluster data that has drive the S&P 500 down 1.8 percent in May -- its worst month since last August.

Rising expectations for a second aid package for Greece sent the dollar lower against the euro, helping lift the prices of dollar-denominated commodities and feeding through into the equity market.

Higher crude oil prices and higher commodity prices have been supportive of the market so the commodity issues are showing strength, said Frank Lesh, a futures analyst and broker at FuturePath Trading LLC in Chicago.

That's what's holding the market up, but boy, the data sure doesn't say 'buy,' does it? he added. I see this stuff and I gotta stop myself from hitting the 'sell' button so much.

U.S. crude futures rose nearly 2 percent to $102.30 a barrel. Exxon Mobil Corp added 0.3 percent to $82.85, while Chevron Corp gained 0.8 percent to $104.05. The S&P energy index <.GSPE> added 0.4 percent.

The Dow Jones industrial average <.DJI> advanced 51.24 points, or 0.41 percent, to 12,492.82. The Standard & Poor's 500 Index <.SPX> rose 4.80 points, or 0.36 percent, to 1,335.90. The Nasdaq Composite Index <.IXIC> gained 12.55 points, or 0.45 percent, to 2,809.42.

The S&P 500 is testing the downtrend line from its May peak at around 1,335, according to analysts from Brown Brothers Harriman. A close above that could indicate the selloff is moderating.

The U.S.-listed stock of Finnish mobile phone maker Nokia was the most heavily traded on the New York Stock Exchange, falling more than 15 percent to a session low at $6.80, a fresh 52-week low, after the company abandoned hope of meeting key targets just weeks after setting them. At midday, the stock had bounced that low to trade at $6.97.

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.

The euro's advance helped lift metals prices, with copper rising to a four-week high. An S&P index of basic materials companies' shares <.GSPM> edged up 0.2 percent.

The end of the month was likely to encourage window dressing, when fund managers add to winners by buying those shares and sell losers to show their portfolios in a better light.

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

The Conference Board also said its index of consumer confidence fell in May on increased pessimism over the labor market and inflation worries.

Consumer discretionary shares were among the weakest. The S&P's sector index <.GSPD> was up a modest 0.3 percent.

The Institute for Supply Management-Chicago said business activity in the U.S. Midwest grew much less than expected in May. The data confirmed a weakening trend in manufacturing and comes ahead of the closely watched national ISM manufacturing survey on Wednesday.

(Editing by Jan Paschal)