Stocks ended higher on Thursday, recovering most of the week's losses, after Greece moved closer to a bond swap with private creditors to avoid a messy default.

Based on the latest available data, the Dow Jones industrial average <.DJI> shot up 70.61 points, or 0.55 percent, to end unofficially at 12,907.94. The Standard & Poor's 500 Index <.SPX> advanced 13.28 points, or 0.98 percent, to finish unofficially at 1,365.91. The Nasdaq Composite Index <.IXIC> gained 34.73 points, or 1.18 percent, to close unofficially at 2,970.42.

(Reporting By Caroline Valetkevitch)