Stocks rose on Thursday as Greece moved closer to concluding a bond swap with private creditors that is needed to avoid a messy default.

The S&P 500 continued to claw back from a string of losses that drove the index down more than 2 percent in three sessions. Even with Wednesday's gains, it is still off slightly for the week.

Athens was on track to secure a deal with bondholders as part of a financial bailout that has been at the center of market concerns globally. If the government misses a repayment, it would potentially destabilize the euro zone's financial system, cripple the euro and take down commodity and equity markets.

The progress in the Greek situation is a relief because the market knows it could have been a lot worse. Investors are getting back into the market and doing some bargain hunting, said Frank Fantozzi, chief executive of Planned Financial Services based in Cleveland, Ohio.

Bets against more market gains were also being made before Friday's government payrolls report. Expectations are for a net gain of 210,000 jobs in February.

An unexpected rise in new U.S. weekly jobless claims, reported Thursday morning, was not enough to change perceptions the labor market was strengthening -- a major catalyst in the current stocks rally.

The Dow Jones industrial average <.DJI> was up 66.90 points, or 0.52 percent, at 12,904.23. The Standard & Poor's 500 Index <.SPX> added 11.97 points, or 0.88 percent, at 1,364.60. The Nasdaq Composite Index <.IXIC> gained 32.23 points, or 1.10 percent, at 2,967.92.

Investors holding at least 61 percent of the more than 200 billion euros in Greek debt have already signed up ahead of the 3 p.m. EST (2000 GMT) deadline for the swap. This means Greece has crossed the minimum threshold needed for a deal and was almost certain to top the two-thirds needed to enforce losses on any holdouts.

An S&P index of basic materials stocks <.GSPM> shot up 1.4 percent, leading the S&P 500's advance. The Reuters/Jefferies CRB commodities index <.CRB> rose 0.6 percent, shifting into positive mode after four straight down sessions.

Coach Inc , the luxury leather goods retailer, hit a record high of $78.22 after the overall positive tone of a presentation at a Bank of America conference. The stock later eased, up 4.4 percent to $76.65.

American International Group Inc fell 2.7 percent to $28.65 after the U.S. Treasury priced its $6 billion offering of AIG stock at $29 a share. That would allow the Obama administration to break even on its investment in the insurer as it winds down bailout programs from the financial crisis.

The S&P financial sector <.GSPF> gained 0.6 percent while the KBW insurance index <.KIX> climbed 0.5 percent.

The Dow was pressured by McDonald's Corp . The stock fell 3.3 percent to $96.94 after the world's largest hamburger chain reported a smaller-than-expected rise in February sales.

(Reporting By Angela Moon; editing by Jan Paschal and Jeffrey Benkoe)