The S&P 500 and Nasdaq shook off earlier losses to end slightly lower on Thursday, while the Dow industrials eked out gains as investors took advantage of a selloff to buy recently outperforming blue chips.

The Dow Jones industrial average <.DJI> gained 19.45 points, or 0.15 percent, to end unofficially at 13,145.82. The S&P 500 Index <.SPX> dipped 2.27 points, or 0.16 percent, to finish unofficially at 1,403.27. The Nasdaq Composite Index <.IXIC> fell 9.60 points, or 0.31 percent, to close unofficially at 3,095.36.

(Reporting by Angela Moon; Editing by Jan Paschal)