U.S. stocks closed mostly higher Tuesday, as gains in oil prices and energy stocks helped offset an earlier decline following news of a downed Russian jet near the Syrian border.
"People are cautious but they aren't turning into any panic mode just now," said Peter Cardillo, chief market economist at First Standard Financial.
The Dow Jones industrial average closed about 20 points higher, with Exxon Mobil and Chevron contributing the most to gains. Earlier, the index fell more than 100 points in mid-morning trade as Goldman Sachs and Walt Disney weighed.
The Dow failed to end in positive territory for the year after briefly trading higher for 2015. The S&P 500 and Nasdaq composite are up about 1.5 and 7.7 percent, respectively, year-to-date.
Energy ended up about 2.2 percent after earlier gaining more than 2.5 percent as the top advancer in the S&P 500.
U.S. crude oil futures settled up $1.12, or 2.68 percent, at $42.87 a barrel, amid the increased geopolitical tension. Earlier, WTI gained more than 3 percent to top $43 a barrel, while brent briefly traded above $46 a barrel.
"Still largely the fundamentals are very much bearish but we know crude oil, when it's time to pack in a risk premium, it can move very quickly," said John Caruso, senior market strategist at RJO Futures.
Read More Russian jet downing boosts oil prices
The Dow transports came off session lows but closed down 0.6 percent, with airlines among the worst decliners.
The Nasdaq composite eked out a gain of 0.3 points after struggling for gains in afternoon trade, as Apple rose nearly 1 percent but Facebook, Amazon and shares of Alphabet fell about 1 percent. Earlier, shares of the three companies fell nearly 2 percent or more to send the Nasdaq more than 1 percent lower.
European stocks ended more than 1 percent lower after news of the downed plane.
The Russia RTS and the Turkey ISE National 100 were off more than 3 percent and 4 percent, respectively. The iShares MSCI Russia Capped ETF (ERUS) closed down about 1.8 percent.
Earlier, Dow futures briefly fell more than 100 points, while S&P 500 and Nasdaq futures dropped more than 0.6 percent.
"Today's terrible news about the downing of the Russian jet and the sharp sell-off in European equities reminds us it's been a pretty nervous year for investors," said Chris Faulkner-MacDonagh, market strategist at Standard Life Investments.
"Certainly the geopolitical tensions are front and center on people's minds today and over the next couple of days, but as soon as that lifts the focus goes on the Federal Reserve," he said.
A Russian warplane was shot down near the Syrian border early Tuesday after it reportedly entered Turkish airspace. State-run Turkish news service Anadolu Agency said the Russian-made downed warplane was engaged by two Turkish F16 jets
Russian President Vladimir Putin said the incident would have serious consequences for the relationship between his government and Turkey's.
In U.S. economic news, revised third-quarter GDP came in as expected, up 2.1 percent from the original reading of 1.5 percent.
Consumer confidence came in at 90.4 for November, missing expectations for 99.5 and below October's 99.1 print.
Ryan Sweet, director of real-time economics at Moody's Analytics, said two declines in sentiment was "a little worrisome" but he "wouldn't extrapolate consumer confidence into what it means for consumer spending, especially in the holiday season."
Treasury yields edged lower, with the near 0.93 percent and the 10-year around 2.23 percent in the close.
The U.S. dollar held about 0.2 percent lower against major world currencies, with the euro higher above $1.06 and the yen at 122.48 yen against the greenback.
The S&P/Case Shiller composite index of 20 metropolitan areas gained 5.5 percent in September on a year-over-year basis compared with 5.1 percent in the year to August. It was above the 5.1 percent estimate from a Reuters poll of economists.
The key data for the Federal Reserve will be the November nonfarm payrolls report due Dec. 4. Also of interest to the central bank will be Wednesday's report on the price inflation measure for personal consumption expenditures, the Fed's preferred gauge on inflation.
As of the close Tuesday, markets were pricing in a 78 percent chance of a December rate hike, according to CME's FedWatch tool.
The closed up 2.55 points, or 0.12 percent, at 2,089.14, with energy leading six sectors higher and utilities and financials the greatest laggards.
The Nasdaq composite closed up 0.33 points, or 0.01 percent, at 5,102.81.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held near 16.
About three stocks advanced for every two decliners on the New York Stock Exchange, with an exchange volume of 915 million and a composite volume of 3.8 billion in the close.
Gold futures settled up $7.00 at $1,073.80 an ounce.
—Reuters contributed to this report.
On tap this week:
Earnings: Deere, Donaldson
8:30 am: Initial claims
8:30 am: Durable goods
8:30 am: Personal income
9:00 am: FHFA home prices
9:45 am: Services PMI
10:00 am: New-home sales
10:00 am: Consumer sentiment
1:00 pm: $29 billion seven-year auction
Stock market closes at 1 p.m.
*Planner subject to change.
More From CNBC.com: