Stocks sharply pared gains in late Wednesday trading, with the S&P 500 briefly negative, weighed by declines in financial and utility shares.

The Dow Jones industrial average <.DJI> gained 17.92 points, or 0.18 percent, to 9,957.90. The Standard & Poor's 500 Index <.SPX> edged up 0.79 point, or 0.07 percent, to 1,062.79. The Nasdaq Composite Index <.IXIC> rose 5.35 points, or 0.25 percent, to 2,175.92.

(Reporting by Rodrigo Campos; Editing by Jan Paschal)