Wall Street closed its best three-day run in the past three months on Wednesday after the Greek parliament approved austerity measures to avoid defaulting on its debt.

Optimism about the plan's approval has helped the stock market recoup some of its losses of the last two months. The CBOE Volatility Index <.VIX>, Wall Street's fear gauge, fell 9.9 percent to 17.27, its third straight decline.

Greek 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.

The whole scary month of June has been healed with these nice three days we've had, said Wayne Kaufman, chief market analyst at John Thomas Financial in New York. That is a pretty good indication that you've got a floor under the market now.

The Dow Jones industrial average <.DJI> gained 72.73 points, or 0.60 percent, to 12,261.42. The Standard & Poor's 500 Index <.SPX> rose 10.74 points, or 0.83 percent, to 1,307.41. The Nasdaq Composite Index <.IXIC> added 11.18 points, or 0.41 percent, to 2,740.49.

Kaufman said the S&P 500's retaking of its April low at around 1,295 was a positive sign, but he noted that the index faced resistance at its 50-day moving average at 1,316.

Financials ranked among the day's best performers. Bank of America Corp rose 3 percent to $11.14 after it reached an $8.5 billion settlement with mortgage bond investors. The S&P financial sector index <.GSPF> rose 1.1 percent.

Visa and MasterCard hit 52-week highs and gave the market a late boost after Federal Reserve staff recommended almost doubling a proposed cap on the amount banks can charge retailers when a debit card is used. Visa's shares jumped 15 percent to $86.57, while MasterCard rose 11.3 percent to $309.70.

But with the S&P 500 up over 2 percent this week, there were signs of weakness in recent gainers such as technology. The Philadelphia semiconductor index <.SOX> dipped 0.1 percent.

The market's breadth, or the difference between rising stocks and falling ones, was narrow on the technology heavy Nasdaq as only slightly more stocks rose then fell.

The rally really hasn't had a lot of momentum -- the volume was light yesterday and today leading into a holiday weekend, said Paul Brigandi, a portfolio manager at Direxion Funds in New York.

Analysts said fund managers were likely engaging in window dressing at the end of the quarter. The process involves adding to winners by buying those names and selling losers to make portfolios look better. The activity can help drive stocks' prices.

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 1.8 percent, buoyed by a 3.7 percent gain in Transocean Ltd to $63.99.

Monsanto Co advanced 5 percent to $70.26 after its quarterly profit topped estimates, while General Mills Inc rose 0.5 percent to $37.38 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.29 after it agreed to a buyout by private equity firm Leonard Green & Partners and another group.

About 7.10 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq -- below the daily average so far this year of around 7.57 billion.

Advancing stocks outnumbered declining ones on the New York Stock Exchange by a ratio of about 7 to 3. On the Nasdaq, nearly seven stocks rose for every six that fell.

(Reporting by Edward Krudy; Editing by Jan Paschal)