Stocks closed higher on Tuesday for a second day in a row as developments in Europe late in the day sparked a rally that erased early weakness.

Based on the latest available data, the Dow Jones industrial average <.DJI> was up 102.02 points, or 0.85 percent, at 12,170.41. The Standard & Poor's 500 Index <.SPX> was up 14.80 points, or 1.17 percent, at 1,275.92. The Nasdaq Composite Index <.IXIC> was up 32.24 points, or 1.20 percent, at 2,727.49.

(Reporting by Caroline Valetkevitch; Editing by Kenneth Barry)