The world's two biggest economies are now at war over trade.

China accused the United States of firing the first shot on Friday when the White House said that it would impose tariffs of 25% on $50 billion worth of Chinese goods.

The announcement confirms a threat first made by President Donald Trump in March and follows months of trade talks between the two sides. A truce was announced in May, but it proved short-lived.

"The United States has kept changing its mind and now launched a trade war," China's Commerce Ministry said in a statement.

The Chinese government said it would respond in kind to the US tariffs, which will apply to roughly 1,100 exports and will target China's aerospace, robotics, manufacturing and auto industries.

"China does not want a trade war," it said, adding that it would "fight back vigorously" in defense of its national interests, globalization and the world trade system.

Related: Trump announces tariffs on $50 billion worth of Chinese goods

"We will immediately launch tariff measures that will match the scale and intensity of those launched by the United States."

Beijing also said "all economic and trade agreements reached by previous negotiations will be nullified at the same time." That includes a tentative deal to increase Chinese purchases of US energy and agricultural goods.

Like the US tariffs, China's retaliatory tariffs will be rolled out in two waves, the Finance Ministry said. And they will start on the same day.

Beijing will impose tariffs on 545 US items worth $34 billion — including agricultural products, automobiles and seafood — starting on July 6.

Tariffs on the remaining 114 items, including chemicals, medical equipment and energy products, will start later.

The United States is targeting 800 Chinese exports, worth about $34 billion, starting July 6, and another 280 or so after a public comment period.

Trump has long complained about China's huge trade surplus with the United States. In a statement Friday, he said trade with China "has been very unfair, for a very long time."

The US president said the new tariffs were designed to punish China for the theft of American intellectual property and technology.

And he warned that any retaliation by Beijing would trigger another round of tariffs on Chinese goods.

Related: These are America's top trading partners

That raises the specter of an intensifying trade war, which would hurt consumers, companies and the global economy. The Dow fell nearly 200 points on Friday after the tariffs were announced.

Growth forecasts for major economies are already being slashed due to the rise of protectionism. Germany's central bank cut its forecast for Europe's biggest economy on Friday.

"An escalating global trade dispute or widespread rises in import tariffs would have a marked negative impact on Germany's export oriented economy," it said.

Related: IMF's Lagarde warns US about trade, deficits

The United States has already imposed tariffs on steel and aluminum from Canada, Mexico and the European Union. All have promised to hit back.

The 28 members of the EU agreed Thursday that retaliatory tariffs would go into effect in the coming days.

"In this day and age, launching a trade war is not in the interest of the world," China's Commerce Ministry said. "We call on all countries to act together to firmly stop such an outdated and backward move, and to firmly safeguard the common interest of all mankind."

-- Steven Jiang contributed to this article.