The Nasdaq briefly turned lower and the Dow and S&P 500 pared gains on Monday, with energy and materials shares leading losses on the S&P.

The Dow Jones industrial average <.DJI> gained 20.97 points, or 0.18 percent, to 11,972.88. The Standard & Poor's 500 Index <.SPX> gained 1.53 points, or 0.12 percent, to 1,272.51. The Nasdaq Composite Index <.IXIC> gained 0.22 points, or 0.01 percent, to 2,643.95.

(Reporting by Caroline Valetkevitch)