U.S. markets racked up steep declines Monday before clawing back most of those losses as global fears of a trade meltdown between the United States and China gave way to news that the sides will keep talking this week in Washington.

The Dow Jones industrial average plunged more than 471 points, or about 1.7 percent, in early trading. But by the end of the day the Dow had recouped almost all of that, finishing 66 points down, or 0.25 percent, at the close.

The Standard & Poor’s 500-stock index and tech-heavy Nasdaq composite index also recovered from shaky starts. The S&P closed down 13 points to finish at 2,932, a decline of 0.45 percent. The Nasdaq finished at 8,123, a loss of 40 points, or half of 1 percent.

“It was certainly buy the dip,” said Kenny Polcari of ButcherJoseph Asset Management. “What happened is the Chinese threatened not to come to the talks. They changed their mind and now are coming. Trump’s tweets did not deter them. So the market bounced.”

However, after the markets closed, senior Trump administration officials accused the Chinese of “reneging” on commitments made earlier in trade talks. They reaffirmed their plan to raise tariffs on a wide range of Chinese goods on Friday.

“Over the course of the last week or so, we have seen an erosion in commitments by China. I would say retreating from specific commitments that had already been made,” said Robert E. Lighthizer, the president’s chief trade negotiator. “That, in our view, is unacceptable.”

The market volatility follows a global sell-off ignited by weekend tweets from President Trump that threw a curve into trade negotiations with China.

The president threatened to increase tariffs from 10 percent to 25 percent on $200 billion worth of Chinese goods on Friday, then follow up with a new 25 percent fee on all remaining Chinese imports “shortly” thereafter. The surprise move jeopardized talks as the two largest economies in the world appeared headed for a deal.

“There were bound to be some hiccups in the trade negotiations,” said Nancy Tengler of Tengler Wealth Management. “The president is negotiating the way he always negotiated, but he has a pretty good hand to play. We will get a deal with China. Until the ink is dry, strap in.”

The volatility on the trading floor arrived after a relatively peaceful first four months of the year that saw corporate earnings grow and the markets grow with them — with some touching all-time highs in recent days.

The S&P 500 finished April with its best four-month open since 1987, according to Howard Silverblatt of S&P Dow Jones Indices.

Its Friday close was less than a point off its all-time high. The Dow climbed 13.6 percent during the same period, while the Nasdaq jumped a startling 23 percent, mostly on the back of the FAANG stocks: Facebook, Amazon, Apple, Netflix and Google parent Alphabet.

On Monday, the Dow saw 19 of its 30 components in the red, with Nike, Caterpillar, Apple and Boeing the biggest laggards. The leaders were UnitedHealth, Chevron, McDonald’s, Pfizer and Disney. Nine of 11 stock sectors were negative. Materials, industrials and information technology, which stand to be hit hardest by trade friction with China, were among the biggest losers.

In Asia, the Shanghai composite finished down 5.6 percent, and the Hong Kong Hang Seng was in the red 2.9 percent. “Investors sold shares overnight and led the way lower for Europe,” Washington investor Michael Farr said.

Analysts said the U.S. economy, which has the lowest unemployment rate since 1969, investor-friendly interest rates and economic growth trimming above 3 percent, won out over worries over China trade.

“Investors have concluded that it remains better to buy than bail,” said Sam Stovall, chief investment strategist at CFRA Research.

Crude oil prices were up about 1 percent by late afternoon as Middle East tensions continued to flare up between Israel and Gaza as well as the United States and Iran. U.S. benchmark West Texas Intermediate saw per-barrel prices were well over $62. The world benchmark Brent crude rose above $71 per barrel.

The United States is deploying an aircraft carrier battle group and bombers to the Persian Gulf to fend off any provocations from Iran. The White House has removed any exemptions allowing countries to buy Iranian oil while avoiding U.S. sanctions, and the Trump administration has said it wants to drive Iranian oil exports to zero.

Trump wants Iran to stop supporting terrorists, to halt missile development and to renegotiate parts of the international nuclear treaty that the United States withdrew from last year.

Ed Yardeni, president of Yardeni Research, said in a report issued Monday that he was less concerned about strains in the China talks than the anxiousness around the Middle East.

"Of the two developments, the second poses a greater risk to world order than the first,” Yardeni said. He added that he expected the United States and China will settle their trade differences “sooner rather than later.”

“On the other hand, the differences between and Israelis and the Palestinians have been intractable for years and not likely to be resolved peacefully in the foreseeable future,” he wrote in his report. “Similarly, Iran has aspirations in the Middle East that are anathema to U.S. interests in the region, including the annihilation of Israel.”