NEW YORK — U.S. stocks remained volatile Monday as the market took a dive in early trading only to erase those losses later and end slightly higher.
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.
The Russell 2000 index of smaller-company stocks dipped 4.99 points, or 0.3 percent, to 1,443.09.
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.”
Lower interest rates harm banks, however, because they reduce profits from lending. Bank of America sank 2.6 percent to $24.76 and JPMorgan Chase lost 1.9 percent to $101.36.
Britain’s May postponed a vote on her deal for Britain to exit the European Union, which had been scheduled for Tuesday. She acknowledged that she would have lost the vote by a significant margin.
The pound sank to $1.2557, down from $1.2751 late Friday. The FTSE 100 stock index fell 0.8 percent. That was better than many other European indexes, as the falling pound helped British exporters.
In Europe, investors bought bonds and sold stocks. Germany’s DAX lost 1.5 percent, and the CAC 40 in France declined 1.4 percent.
Japan’s benchmark Nikkei 225 slid 2.1 percent, South Korea’s Kospi fell 1.1 percent and Hong Kong’s Hang Seng shed 1.2 percent.
Revised data showed the Japanese economy shrank by 2.5 percent in the third quarter, a larger decline than analysts expected. Chinese imports and exports climbed at a much slower pace in November than they had in October.
In other commodities trading, wholesale gasoline fell 4.5 percent to $1.42 a gallon. Heating oil skidded 2.2 percent to $1.84 a gallon. Natural gas rose 1.3 percent to $4.55 per 1,000 cubic feet.
Gold slipped 0.3 percent to $1,249.40 an ounce. Silver lost 0.6 percent to $14.61 an ounce. Copper slid 1.4 percent to $2.72 a pound.
The dollar rose to 113.21 Japanese yen from 112.64 yen late Friday. The euro slipped to $1.1353 from $1.1422.