Stocks posted gains for the fourth day on Tuesday on growing hopes that Greece will avoid a debt default, adding momentum to the market's recent rebound.

The Dow Jones industrial average <.DJI> gained 109.63 points, or 0.91 percent, to end unofficially at 12,190.01. The Standard & Poor's 500 Index <.SPX> rose 17.16 points, or 1.34 percent, to finish unofficially at 1,295.52. The Nasdaq Composite Index <.IXIC> added 57.60 points, or 2.19 percent, to close unofficially at 2,687.26.

(Editing by Jan Paschal)