U.S. stocks advanced on Wednesday after the Greek parliament approved austerity measures, taking an important step in the country's bid to gain access to international funding to avoid default.

Lawmakers approved a five-year package of spending cuts, tax increases and state asset sales by a comfortable margin of 155 votes to 138 in a roll-call vote, handing a significant victory to embattled Prime Minister George Papandreou.

Optimism over the plan's approval in Greece has pushed the benchmark S&P 500 to its best three-day performance in three months. The CBOE Volatility Index <.VIX>, Wall Street's fear gauge known as the VIX, fell 9.2 percent to 17.41, its third straight decline.

Certainly the fear that Greece is going to default now has subsided, said Ken Polcari, managing director of ICAP Equities in New York.

Although it is still not a done deal -- but the fact is, it is certainly moving along, so that is obviously positive.

The Dow Jones industrial average <.DJI> gained 82.83 points, or 0.68 percent, to 12,271.52. The Standard & Poor's 500 Index <.SPX> rose 11.10 points, or 0.86 percent, to 1,307.77. The Nasdaq Composite Index <.IXIC> climbed 14.94 points, or 0.55 percent, to 2,744.25.

Financials were among the best performers. Bank of America Corp rose 3.1 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 about potential financial damage.

The S&P financial sector index <.GSPF> was up 1.8 percent.

Commodity related shares also moved higher as the euro rose and the U.S. Dollar Index <.DXY> fell against a basket of major currencies. Commodities often move inversely to the dollar as they are priced in the U.S. currency on international markets.

The PHLX OIl Service sector index <.OSX> gained 2.4 percent, buoyed by a 3.8 percent gain in Transocean Ltd to $64.05.

Monsanto Co advanced 4.1 percent to $69.65 after its quarterly profit topped estimates, while General Mills Inc rose 0.9 percent to $37.53 after the cereal maker forecast weaker fiscal-year earnings than Wall Street expected.

In other company news, BJ's Wholesale Club Inc added 4.6 percent to $50.27 after it agreed to a buyout by private equity firm Leonard Green & Partners and another group.

Economic data showed 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.

(Reporting by Chuck Mikolajczak; Editing by Jan Paschal)