The Dow Jones Industrial Average lost as much as 507 points in early trading before ending with a gain of 34.
Energy companies fell as the price of crude oil dropped 3 percent, giving back its gains from last week. Banks fell as investors expected slower increases in interest rates.
Technology companies led the gainers. Qualcomm rose after the chipmaker said a Chinese court banned some Apple phones as part of a long-running dispute over patents.
Weak economic data in China and Japan and uncertainty over Britain’s status in the European Union knocked down overseas indexes. The British pound dropped to its lowest level in more 18 months after Prime Minister Theresa May postponed a vote on the country’s departure from the European Union.
Tensions between the U.S. and China kept climbing following the detention of Huawei Chief Financial Officer Meng Wanzhou. She is suspected of trying to evade U.S. trade curbs on Iran, and she was detained while changing planes in Canada.
China summoned both the U.S. and Canadian ambassadors to meetings over the weekend and protested her arrest. Meng’s arrest has jolted the stock market.
“It’s a source of great anger for China that this could happen,” said Kristina Hooper, chief global market strategist for Invesco. “China is looking for retaliation, and the most appropriate place for retaliation would be in trade negotiations with the U.S.”
The S&P 500 index gained 4.64 points, or 0.2 percent, to 2,637.72. The Dow added 34.31 points, or 0.1 percent, to 24,423.26. Technology companies, which have fallen sharply since October, did better. The Nasdaq composite rose 51.27 points, or 0.7 percent, to 7,020.52.
U.S. indexes have been lurching up and down since October, mostly down. The S&P 500 plunged 4.6 percent last week for its biggest loss in more than eight months as investors felt the U.S. and China are still nowhere close to ending their trade dispute.
Volatility has been high not only week to week but also minute to minute. The S&P 500 zoomed from a gain of 0.2 percent to a loss of 1.8 percent Monday morning.
Technology companies ended higher. Microsoft climbed 2.6 percent to $107.59 and Qualcomm added 2.2 percent to $57.24. Broadcom jumped 4.7 percent to $239.25.
Crude oil resumed a steep decline that began in early October. Benchmark U.S. crude fell 3.1 percent to $51 per barrel in New York. Brent crude, the international standard, lost 2.8 percent to $59.97 a barrel in London.
Prices steadied last week after OPEC and other major oil producers said they will reduce production by 1.2 million barrels a day starting from January. The cuts will last for six months.
Energy stocks took dipped. Exxon Mobil lost 1.4 percent to $76.54 and Schlumberger shed 2.5 percent to $41.97.
Bond prices ended slightly lower. The yield on the 10-year Treasury slipped early on, but later rose to 2.86 percent from 2.85 percent late Friday. The 10-year yield spiked to a seven-year high in early November and has fallen sharply since then.
Hooper, of Invesco, said stocks have bounced back from their early losses because Wall Street thinks the Fed might react to the trade turmoil by raising interest rates at a slower pace.
“There are certainly some bargain hunters at work today, but more than that is the growing recognition that we could see the Fed take its foot off the accelerator,” she said. “That could be a source of momentum, a positive force for markets.”