Chinese Vice Premier Liu He, right, watches as U.S. Treasury Secretary Steven Mnuchin, center, swaps places with U.S. Trade Representative Robert E. Lighthizer before talks May 1 in Beijing. (Andy Wong/Pool/Reuters)

China warned Wednesday of retaliation if President Trump goes through with his threat to further raise tariffs on Chinese goods, setting up a potential escalation in a trade war that had seemed just weeks ago to be nearing its end.

The trans-Pacific brinkmanship now spills over to face-to-face negotiations as trade talks resume late Thursday in Washington — just hours before Trump’s latest tariff threats are due to hit $200 billion in Chinese products.

The Chinese warning — issued as China’s vice premier arrived in Washington — signaled that Beijing was prepared to take the same hard-line route as Trump and raise tariffs on American products in response.

“An escalation in trade frictions is not in line with the American or Chinese interests or the interests of the world, and would thus be much to China’s regret,” a spokesman for the Commerce Ministry said in a statement on its website.

“But if the U.S. goes ahead with its tariff measures against China, China will have to resort to necessary countermeasures,” the statement added.

Until just days ago, the two sides appeared close to a deal, with Trump saying last month they were forging a “monumental” and “epic” pact.

The Trump administration has been pushing China not only to narrow its trade gap with the United States but also to institute major reforms on matters such as support for state-backed companies and intellectual property rights.

There appeared to be some headway. But then Trump tweeted Sunday that China had attempted to renegotiate the almost-completed deal.

He threatened to increase tariffs from 10 percent to 25 percent on Friday and to levy a new 25 percent fee on the remaining $325 billion of Chinese imports “shortly” if there is no progress toward a trade deal.

This sudden shift sent Asian financial markets tumbling. Wall Street also has taken a hit. But U.S. investors Wednesday were more sanguine, with the Dow Jones industrial average closing almost unchanged.

Even before the next round of trade talks, the Trump administration was on the offensive.

The U.S. trade representative’s office released a Federal Register notice explaining the potential tariff hike and taking a jab at China.

“In the most recent negotiations, China has chosen to retreat from specific commitments agreed to in earlier rounds,” the notice said.

Trump then sought to explain his assertions of Chinese wobbling in terms of U.S. politics.

“The reason for the China pullback & attempted renegotiation of the Trade Deal is the sincere HOPE that they will be able to ‘negotiate’ with Joe Biden or one of the very weak Democrats, and thereby continue to ripoff the United States,” the president tweeted.

China has responded with reciprocal measures during earlier iterations of the trade war, slapping duties on American soybeans, cars and other products.

There is not much time to avoid a possible new barrage of tariffs between the world’s two biggest economies.

Liu He, the lead Chinese negotiator, is set to meet with his American counterparts, Treasury Secretary Steven Mnuchin and U.S. Trade Representative Robert E. Lighthizer, for talks scheduled to wrap up Friday.

Still, Chinese authorities were trying to reassure markets. And China’s state media has now swung into action.

Some state-shaped messages from Beijing were pragmatic — acknowledging that there are “thorny structural differences between China and the United States that are difficult to resolve at the moment.”

But the main tone was one of strength and resilience.

“Tried and tested by the trade war for more than a year, entrepreneurs and ordinary people in China have learned to handle everything with grace and greater ease now,” state news agency Xinhua wrote in a commentary published Wednesday. “Chinese society has weathered storms and is now able to endure great stress. We have also learned that the world doesn’t end, as long as we keep our own house in order.”

The overseas edition of the People’s Daily, the mouthpiece of the Communist Party of China, described the Chinese economy “like a vibrant, vast forest with a solid foundation, strong resilience, high quality and great potential.”

It can, the paper’s commentary continued, “withstand the wind and rain from the outside environment as well as soaking up the bright sunshine of win-win cooperation.”

Other state papers lauded China’s surprisingly strong growth figures for the first quarter, which showed a better-than-expected 6.4 percent expansion between January and March compared with a year ago.

“Market confidence is picking up and positive factors are setting in,” the Guangming Daily declared on its front page Wednesday. “The Chinese economy has great resilience and huge potential.”

But statistics show a different story.

Trade data released Wednesday showed that Chinese export growth was disappointing last month. The value of Chinese exports fell 2.7 percent in April compared with the previous year, against market expectations of 3 percent growth.

While the slump in domestic demand and exploding debt levels are the main reason for China’s slowing economy, the trade tensions are weighing heavily on it.

“If Trump follows through on his latest tariff threats, we think this would drag down export growth by two to three percentage points,” said Julian Evans-Pritchard, senior China economist at Capital Economics. “And even if a last-minute deal is struck this week to avoid further tariffs, the downbeat prospects for global growth will probably mean that export growth remains subdued,” he wrote in a note to clients.

China’s trade surplus narrowed sharply to $13.84 billion in April, according to data from the General Administration of Customs. This was far below the $32.65 billion recorded in March and against economists’ expectations that the surplus would grow.

There are other signs of trade-related stress in the world’s second-largest economy.

Buyer numbers and export orders were down during the three-week Canton Fair, organizers said when it wrapped up Sunday. The trade fair, China’s largest, is held in the manufacturing powerhouse in the south and is often viewed as a barometer for the health of the Chinese economy and foreign trade conditions.

The stakes are high for Chinese President Xi Jinping, who has a vision to make China a global superpower to rival the United States and who has asserted strong control over the ruling Communist Party, including by eliminating limits on his presidency.

“On some issues, Xi won’t budge, most obviously on the right for China to pursue policies to make its technological base competitive with the U.S. Any concessions here could be dangerous for him domestically,” said Richard McGregor, author of a book about the Communist Party and a China expert at the Lowy Institute in Sydney.

“But in other areas, it’s always been true that some of Xi’s advisers would like to use the trade talks as an excuse to push through reforms. The question is whether Xi goes along with them,” McGregor said, referring to the structural reforms that the United States would also like to see, such as eliminating the special treatment for state-owned enterprises.

Lynch reported from Washington.