(Updates to final hour of trading)
By Caroline Valetkevitch
NEW YORK, Oct 14 (Reuters) - The Dow and S&P 500 briefly turned lower in late trading on Tuesday, putting the market at risk for a fourth day of declines and a continuation of the recent selloff that has kept investors on edge.
Energy shares were the biggest drag in late trading, with the S&P energy index falling along with oil prices. Brent crude oil settled 4.3 percent lower; the energy index was last down 1.1 percent.
Stocks had been solidly in positive territory for much of the session before the late turnaround.
At 3:39p.m., the Dow Jones industrial average rose 8.8 points, or 0.05 percent, to 16,329.87, the S&P 500 gained 5.42 points, or 0.29 percent, to 1,880.16 and the Nasdaq Composite added 22.36 points, or 0.53 percent, to 4,236.01.
Editing by Nick Zieminski