Wall Street rose on Wednesday after the Greek parliament approved austerity measures to avoid defaulting on its debt, but stocks were off their highs, with the Nasdaq briefly turning negative on profit-taking after hefty gains this week.

The Dow Jones industrial average <.DJI> gained 49.27 points, or 0.40 percent, to 12,237.96. The Standard & Poor's 500 Index <.SPX> rose 6.27 points, or 0.48 percent, to 1,302.94. The Nasdaq Composite Index <.IXIC> added 1.56 points, or 0.06 percent, to 2,730.87, after dipping as low as 2,722.26.

(Reporting by Edward Krudy; Editing by Jan Paschal)