Stocks rose on Wednesday after the Greek parliament passed an austerity plan and a mildly encouraging report on pending home sales.

Equities have rallied for two days in a row on optimism the Greece program would pass, with the S&P up more than 2 percent so far this week.

The vote being passed is a step in the right direction to getting resolution, said David Levy, portfolio manager at Kenjol Capital Management in Austin, Texas. We've had the issue on the table for some period of time now, and as resolution is reached it will give the market confidence.

The Greek parliament approved a five-year package of spending cuts, tax rises and state asset sales by a comfortable margin in a key step toward securing international funds and preventing the euro zone's first sovereign default.

U.S. pending home sales rose a stronger-than-expected 8.2 percent in May, but a glut of unsold properties remained a drag on the housing market. The latest data followed a mildly encouraging housing on Tuesday.

The improvement in home sales is encouraging, but this doesn't even begin to solve the structural issues in the sector, said Liam Dalton, president of Axiom Capital Management Inc in New York. Still, any sign of stability is a victory.

The Dow Jones industrial average <.DJI> was up 39.81 points, or 0.33 percent, at 12,228.50. The Standard & Poor's 500 Index <.SPX> was up 6.77 points, or 0.52 percent, at 1,303.44. The Nasdaq Composite Index <.IXIC> was up 7.55 points, or 0.28 percent, at 2,736.86.

Bank of America Corp rose 3 percent to $11.15 after it reached a settlement with mortgage bond investors. The $8.5 billion settlement removed a question mark hanging over the bank since October.

BJ's Wholesale Club Inc added 4.8 percent to $50.40 after it agreed to a buyout by private equity firm Leonard Green & Partners and another group.

Monsanto Co advanced 4 percent to $69.54 after its quarterly profit topped estimates, while General Mills Inc edged 0.1 percent higher to $37.26 after the cereal maker forecast weaker fiscal-year earnings than Wall Street expected.

(Editing by Jeffrey Benkoe)