U.S. stocks closed mostly lower Tuesday in a session that saw the key indexes weave in and out of positive territory as investors weighed mounting political tension in the nation’s capital against renewed optimism over U.S.-China trade talks.

The Dow Jones Industrial Average DJIA, -1.92% shed 53.02 points, or 0.2%, to 24,370.24 while the S&P 500 index SPX, -2.37% slipped 0.94 point to 2,636.78 and the Nasdaq Composite Index COMP, -3.01% edged up 11.31 points, or 0.2%, to 7,031.83.

A contentious meeting between President Donald Trump and Democratic leaders Chuck Schumer and Nancy Pelosi over border security, with Trump threatening to shut down government, battered already fragile sentiment.

Stocks had charged higher at the opening bell after the U.S. and China launched formal trade talks with a phone call. The initial conversation included Treasury Secretary Steven Mnuchin, U.S. Trade Representative Robert Lighthizer and Chinese Vice Premier Liu He, where they discussed changes to fundamental Chinese economic policies.

In the call, China informed U.S. officials that it had agreed to reduce tariffs on U.S. autos to 15%, down from 40%. The move was credited with lifting shares of Ford Motor Company F, -2.06% and General Motors Co. GM, -0.34% .

Read:Stock market on ‘cliff’s edge’ as S&P 500 tests this crucial support level: chart watcher

What data were in focus?

The National Federation of Independent Businesses issued its small business optimism index for November, showing it fell to 104.8 from 107.1 in October, its lowest reading since May.

The wholesale cost of goods and services rose by 0.1% in November, above consensus estimates of a 0.1% decline, according to a MarketWatch poll of economists. Year-over-year rises in producer prices, however, fell to 2.5% from 2.9%, according to the Labor Department.

What were strategists saying?

“Hard to rally on the same news more than twice. Market opened on hopes of trade concessions with China. Trade is a long-term discussion [with] no resolution of substance until much further down the road. Therefore all rallies have be treated with suspect particularly given the strong downside momentum in force since October,” said Bruce Bittles, chief investment strategist at Baird.

“Today is pretty much a mirror image of yesterday. We started out strong and now the early gains have been whittled away just as the market clawed back early losses yesterday,” said Colin Cieszynski, chief market strategist at SIA Wealth Management Inc.”Overall, volatility remains high with neither side — bulls or bears — able to exert control for more than a day or two.”

Larry Benedict, chief executive of the Opportunistic Trader, said that investors remained “skittish.” “The true giveaway in my mind,” that markets aren’t about to mount a year-end rally, “is that volatility is still elevated at roughly 22,” he said. “If this were the real deal, volatility would be near 15.”

What stocks were in focus?

Alphabet Inc. shares GOOGL, -3.45% GOOG, -3.42% rose 0.8% as its Chief Executive Officer Sundar Pichai was grilled on Capitol Hill over the search giant’s practices and its alleged political bias.

Apple Inc. shares AAPL, -4.19% fell 0.8% amid lingering concerns about the company’s business model and a series of setbacks in China, a key market.

Shares of Francesca’s Holdings Corp. FRAN, -10.75% skidded 15% after the firm announced a quarterly loss and a decline in store foot traffic.

DSW Inc. US:DSW rallied 10% after the company roundly beat estimates for third-quarter profits and sales, while raising its 2018 outlook.

Pfizer Inc. PFE, -0.69% shares slid 0.6% after the stock was downgraded to neutral from overweight by JPMorgan.

How were other markets trading?

Asian stocks closed broadly higher, with Chinese benchmarks leading the way. The Shanghai Composite Index SHCOMP, -1.72% rose 0.4% the Shenzhen Composite 399106, -2.45% gained 0.9%.

European markets advanced, with the Stoxx Europe 600 SXXP, -1.11% up on the day.

Crude oil US:CLF9 rose while gold US:GCG9 settled lower and the U.S. dollar DXY, +0.01% gained.

—Barbara Kollmeyer contributed to this report