A rare respite in the U.S.-China trade war abruptly lifted U.S. markets out of their slump Tuesday, after the Office of the U.S. Trade Representative announced that tariffs on consumer goods such as laptops, cellphones and toys will be delayed until Dec. 15.

The move to temporarily shield certain products from the latest round of tariffs on $300 billion in Chinese goods, which is scheduled to take effect Sept. 1, will offer some relief for companies and consumers that were bracing for costly trade-related burdens during the holiday shopping season.

President Trump told reporters Tuesday that the delay was a way to keep the tariffs from having “an impact on the Christmas season.”

As for the stock rally, the president said in a brief session with reporters Tuesday that “the stock market is way up today for various reasons, including tariffs.”

“Of course the market is going to rally,” said Kenny Polcari of Butcher Joseph Asset Management. “It’s complete manipulation. He threatens the market by surprise two weeks ago. The markets re-price. Then he says, ‘I think we are going to delay those tariffs.’ The nervousness disappears, and the [algorithms] respond immediately and take the market higher.”

In a matter of minutes, the Dow Jones industrial average leaped more than 500 points, starting from negative territory and swinging up more than 2 percent. The blue-chip 30 closed at 26,275, a 367-point gain on the day, about 1.42 percent. Apple, Intel, Cisco and Microsoft were among the biggest gainers, showing how much the technology sector is tied to the Chinese economy.

The Standard & Poor’s 500-stock index raced ahead 42 points to finish the day at 2,925, a 1.44 percent increase. The tech-heavy Nasdaq composite index, which houses a great deal of U.S. companies with exposure to China, closed up 1.95 percent at 8,016, a 153-point rise.

Apple, which relies on China for 20 percent of its sales, had been taking a shellacking in recent weeks because of the escalating trade rift. Its stock was down 9 percent in the first few sessions of August. Apple shares closed upward 4.19 percent on Tuesday.

“For Apple, which has become the poster child of this US/China UFC trade battle, this is a major shot in the arm for the bulls as importantly Cook & Co. will be facing no tariff noise/costs when the trifecta of iPhones launch in the September time-frame,” Dan Ives, an analyst with Wedbush Securities, wrote in a note to investors Tuesday.

Electronics giant Best Buy was up more than 8.5 percent, while toy makers Mattel and Hasbro both saw their shares soar more than 5 percent. Footwear juggernaut Nike, which also depends heavily on China, was up nearly 3 percent.

“We are pleased the administration is delaying some tariffs ahead of the holiday season and acknowledging the impact on American consumers,” the National Retail Federation said in a statement. “Still, uncertainty for U.S. businesses continues, and tariffs taking effect September 1 will result in higher costs for American families and slow the U.S. economy. During this delay period, we urge the administration to develop an effective strategy to address China’s unfair trade practices by working with our allies instead of using unilateral tariffs that cost American jobs and hurt consumers.”

All 11 stock market sectors went positive, led by technology, consumer staples and telecommunication services.

The sudden swing offers the first glimmer of hope after a nightmarish stretch for markets. August is historically one of the worst months of the year for stocks.

The Dow was 5 percent below its July 15 all-time high coming into Tuesday. The blue-chip average dropped 390 points Monday on continuing fears that Hong Kong protests, falling worldwide bond yields and the ongoing U.S.-China trade dispute could exacerbate a global recession.

But the upward tilt from the tariff delay Tuesday was broad, pulling up oil prices and the yield on the closely watched 10-year U.S. Treasury bond. The 10-year yield increased to 1.692 percent, more of a bullish sign for investors. Bond yields rise when bond prices fall, signaling that investors may be more comfortable with higher-risk equities.

U.S. benchmark crude oil prices jumped 3.9 percent on the futures market. European Brent crude was even higher, surging 4.61 percent. The increase in oil prices means traders were hopeful that the United States and China might settle their trade differences, which would help the world economy.

Tuesday’s stock market surge came after a turbulent week and a report Tuesday morning that inflation may be beginning to raise its head. July’s consumer price index rose 0.3 percent, the Labor Department reported Tuesday. The rise was above the 0.2 percent that experts expected.

Markets have been roiled in recent weeks from a number of sources including fears of a currency war with China, massive protests in Hong Kong, an escalation of the U.S.-China trade war and an investor flight to bonds.

“If the Chinese go into Hong Kong, you will change the dynamic from one of the world’s most business-friendly governments and important financial centers, and it will be gone and done away with,” said Jeffrey Saut of Capital Wealth Planning. “If the Chinese go in, they will never leave. That’s a big deal.”

Goldman Sachs released a report last weekend anticipating lower economic growth in the United States due to the ongoing U.S.-China trade battle. Goldman also predicts that the United States and China will not resolve their trade disagreements before the 2020 election, further clouding the economic picture.