Stocks held moderate gains, but retreated from session highs at midday on Friday as investors wrestled with the prospect that the Federal Reserve might have to raise interest rates after data showed the economy shed far fewer jobs than expected last month.

Banks' and home builders' shares advanced, supporting both the Dow and the S&P 500, after the November payrolls data improved the outlook for the U.S. economy's recovery. An S&P index of financial services stocks <.GSPF> gained 1.2 percent, while the Dow Jones U.S. home construction index <.DJUSHB> added 0.7 percent.

The Nasdaq got a substantial lift from chipmakers, including Intel Corp , advanced following an upbeat forecast from TSMC <2330.TW>, the world's biggest contract chip maker. Intel's stock was up 2.3 percent at $20.33. The semiconductor index <.SOXX> shot up 1.6 percent.

To foster a recovery, the Federal Reserve has kept U.S. benchmark interest rates close to zero percent, a stance that analysts said might have to change as the economy showed more signs of life.

U.S. employers cut 11,000 jobs in November, the smallest loss since the start of the recession in December 2007, and the unemployment rate also dipped, according to a Labor Department report. The U.S. unemployment rate slipped in November to 10.0 percent from October's rate of 10.2 percent, which was a 26 1/2-year high.

Since the broader market hit a bottom in early March, stocks and the dollar have had a strong inverse correlation. When the dollar falls, stocks tend to rise and vice versa.

That correlation partly reflects the so-called carry trade, whereby investors borrow a currency offering relatively low borrowing costs in order to invest the proceeds in higher-yielding assets denominated in that low-yield currency.

Strength in the U.S. dollar caused investors to unwind some of their dollar carry-trade positions, according to analysts.

The dollar is getting stronger ... and we're seeing a reversal today in the gold market, with U.S. gold futures falling more than $40 an ounce after the surprising jobs data, said Robert Francello, head of equity trading for Apex Capital in San Francisco.

The Dow Jones industrial average <.DJI> gained 15.57 points, or 0.15 percent, to 10,381.72, after earlier hitting an intraday high at 10,516.70. The Standard & Poor's 500 Index <.SPX> rose 5.13 points, or 0.47 percent, to 1,105.05, off its session high at 1,119.13. The Nasdaq Composite Index <.IXIC> gained 14.48 points, or 0.67 percent, to 2,187.62, after rising to an intraday high at 2,214.39.

Earlier, stocks rallied briskly, with the Dow, the S&P 500 and the Nasdaq climbing to their highest levels in 15 months.

But by midday the major indexes turned negative briefly as the U.S. dollar strengthened, putting pressure on global commodities like crude oil and gold.

That in turn, weighed on shares of natural resource companies, sending the S&P materials index <.GSPM> down 0.8 percent. The S&P energy index <.GSPE> declined 0.3 percent, while the U.S. dollar index <.DXY>, which measures the greenback against a basket of six other major currencies, jumped 1.2 percent.

An improving labor market is considered crucial in fostering a recovery and in bolstering confidence among consumers, whose spending accounts for about two thirds of U.S. economic activity.

(Reporting by Ellis Myandu; Additional reporting by Caroline Valetkevitch; Editing by Jan Paschal)