Major U.S. stock indexes turned higher in late afternoon trading Friday, shaking off an early slump triggered by the latest escalation in the trade war between the U.S. and China and more in Friday’s Stock Market Update.

The market fell sharply in the early going after the U.S. raised tariffs on $200 billion worth of Chinese goods after negotiators failed to reach a deal. Hours later, remarks from Trump and Treasury Secretary Steven Mnuchin gave investors reason for optimism.

First, Mnuchin told CNBC that the trade talks had been “constructive,” which spurred the market’s rebound. Then, in a late- afternoon tweet, Trump suggested the tariffs could be removed and that the trade talks “will continue.”

Gains in consumer goods makers, utilities and other sectors outweighed losses elsewhere in the market. Many technology stocks also turned higher, although Apple remained down 1.1%.

The afternoon pickup in buying did little to blunt the overall sharp decline for stocks this week. The benchmark S&P 500 index was on track for its worst week of the year.

“Nobody wants to sell too aggressively just in case things get settled and the market rallies,” said J.J. Kinahan, chief market strategist for TD Ameritrade. “As long as they’re still talking there’s a chance that this gets done.”

STOCK MARKET UPDATE

The S&P 500 rose 10 points, or 0.4%, to 2,881 by closing time. The broad index, which earlier had been down 1.6%, has given back much of the gains it made in April. It’s still up 14.8% for the year.

The Dow Jones Industrial Average gained 116 points, or 0.5%, to 25,944. It was down as much as 358 earlier. The technology heavy Nasdaq rose 6 points, or 0.1%, to 7,916 after having been down as much as 1.9% earlier.

The Russell 2000 index of small company stocks was 0.2% lower. Major indexes in Europe closed mostly higher.

The higher tariffs from the U.S. and China’s response that it would take “necessary countermeasures” rattled investors Friday who had been hoping for a quick resolution to the dispute. Confidence in that outcome had eased investors’ concerns this year, along with a more patient Federal Reserve and solid economic data. It all added up to help push stocks to their hottest start to a year in decades.

The trade war has stressed consumers and companies with higher costs on goods. The latest tariff increase raises tariffs from 10% to 25% on $200 billion of Chinese imports. Trump has signaled that he might expand penalties to all Chinese goods shipped to the U.S.

The reaction in the stock market has been sharp, but it hasn’t approached last year’s sell-off when the S&P 500 plummeted nearly 20% on worries about a possible recession and worsening of the U.S.-China trade dispute. Even after this week’s tumult, the index remains within 2.3% of its record set on April 30.

That’s because many investors continue to expect the United States and China to come to an agreement eventually, said Anthony Saglimbene, global market strategist at Ameriprise Financial. Neither country would benefit from not getting a deal, he said. In the meantime, the U.S. job market continues to grow, and balance sheets for American households remain better than before the Great Recession.

“We have advised long term investors to look through the noise of the next few weeks and what goes on with trade because the economy is strong and earnings should grow better than expected,” Saglimbene said. “I wouldn’t expect the market would go down 5 or 10% just because we put these tariffs on. I would expect it would decline 5 or 10% if the trade tensions are escalating.”

Things, though, could get dicier not only if the U.S.-China talks break down but also if the trade war intensifies on other fronts. The United States may be nearing a decision on whether to impose tariffs on imports of European automobiles, for example.

The market’s gains this year had been slow but steady up until this week. Prior to this week, the S&P 500 only had four losing weeks this year, most of them minor. Other than that, it’s been mostly up amid a mostly muted year with no major market-moving news. Investors have been cautiously watching corporate earnings, and have been mostly surprised by solid results, though several big companies, including Mylan, TripAdvisor and Wynn Resorts fell sharply after disclosing disappointing earnings or outlooks.

The slump this week has been especially hard on technology stocks, which have far outpaced the rest of the market this year. Those companies do a lot of business in China and would stand to lose greatly if the trade war drags on.

The Nasdaq index, which is heavily weighted with technology stocks, is on track to lose 3% for the week after an even stronger run this year than the S&P 500. The weekly drop would be only its third this year and the biggest since late December. The Nasdaq is still up 19.4% in 2019.

Uber had an inauspicious debut on the stock market. The giant ride-hailing company’s hotly anticipated stock offering landed with a flop as its shares slid as low as $41.06 in very heavy volume shortly after trading opened. That was well below Uber’s initial offering price of $45 a share. That price was already at the low end of its targeted price range. In afternoon trading it was down 2.8% at $43.77.

Investors are cautious about Uber after its main rival, Lyft, had a rollercoaster stock market debut last month. Lyft initially surged well beyond its IPO price, but then slumped on its first full day of trading. That stock was trading Friday at $52.18, well below its IPO price of $72.

© The Associated Press. All rights reserved.