President Donald Trump has moved ahead with steep tariffs on steel and aluminum, upsetting many of America's biggest trading partners.

The measures are more nuanced than what Trump and his advisers had initially threatened to do. Canada and Mexico are exempt from the tariffs for the time being, and other US allies will be allowed to apply to be let off.

But analysts have warned the move -- which Trump says is necessary for American national security -- will still ramp up tensions and could lead to a trade war.

Here's how the countries that do the most trade with the United States are responding:

China: 'A serious attack'

China, the world's biggest exporter, accused the United States of carrying out protectionism in the name of national security.

The Chinese Commerce Ministry called Trump's tariffs "a serious attack on normal international trade order" and said that Beijing is "firmly opposed" to the measures.

Related: Tariffs, Trump and trade wars: Here's what it all means

Some form of retaliation appears likely from China, with which the US traded more goods than any other country last year. Beijing will take "firm actions" if the tariffs inflict losses on Chinese businesses, Commerce Ministry official Wang Hejun said Friday.

Trump has directed much of his harsh rhetoric on steel toward China, the world's largest exporter of the metal. But the vast majority of Chinese steel shipments go to other countries. Barely 2% of the steel imported into the US last year came from China, according to data from S&P Global Platts.

The world's two largest economies buy and sell a huge amount of other goods from each other, though. Total trade between the countries reached $636 billion last year, according to US government data.

South Korea: Steel tariffs are 'unjust'

Using national security as a pretext to limit imports of South Korean steel is "unjust," Trade Minister Paik Un-gyu said in a statement Friday expressing his "displeasure" at the move.

South Korea will use Trump's tariffs as an opportunity to seek new markets for its steel, the Trade Ministry said in a statement. But it added that it will "do its best" to get on the list of countries that are exempt from the restrictions.

Seoul will "actively respond" to the tariffs, the ministry said, but it didn't specify whether it would take any retaliatory action against US goods.

South Korea is the sixth biggest US trading partner and a key military ally in Asia. It's also the third largest exporter of steel to the US, accounting for about 10% of US imports of the metal by volume, according to S&P Global Platts.

Japan: Trump's decision is 'regrettable'

Japan, another major US ally in Asia, called Trump's decision to impose tariffs "regrettable."

"This measure might impact the economy and the cooperative relationship between Japan and the US," the Ministry of Foreign Affairs said in a statement on Friday.

It said it would study the move's impact on Japanese companies before responding further.

Japan is the fourth biggest trading partner with the US. It accounts for about 5% of steel imported to the US, according to S&P Global Platts.

European Union: Clarity is needed

European Trade Commissioner Cecilia Malmström said in a tweet that the European Union is a "close ally" of the United States and "we continue to be of the view that the EU should be excluded from these measures."

"I will seek more clarity on this issue in the days to come," Malmström said, adding that she would discuss the issues with United States Trade Representative Robert Lighthizer on Saturday in Brussels.

The EU has said it could respond with new tariffs on American products including orange juice, bourbon, denim, cranberries, peanut butter and motorcycles.

Related: EU could hit US peanut butter and cranberries with tariffs

The bloc has also said it would challenge the legality of the US metal tariffs at the World Trade Organization.

The UK's top trade official, Liam Fox, said on Thursday evening in Britain that "the way that the United States is going about this is wrong." He said the idea that Britain would be penalized on national security grounds was "absurd."

The EU represents many top US trading partners, including Germany, the UK, France and Italy.

Canada: Exemption is 'a step forward'

Canada is expressing cautious optimism after Trump announced the country is exempt from the new steel and aluminum tariffs.

The outcome "is a step forward," Foreign Minister Chrystia Freeland said in a statement Thursday.

Related: Trump tariffs: Why sparing some countries could make trade chaos worse

Trump said that Mexico and Canada would be spared from the tariffs as they continue to renegotiate NAFTA with the US. But it's not clear what would happen if those talks fall through.

Canada is drawing a line between the two issues.

The new metal tariffs and the NAFTA negotiations "are separate and let me underscore that they are on a separate track," Freeland told reporters.

Canada is the largest supplier of both steel and aluminum to the US.

It's also the US' second largest trading partner, accounting for more than $580 billion worth of imports and exports of goods last year.

Mexico: Tariffs are separate from NAFTA talks

Mexico, the third biggest trading partner with the US, was also exempted from Trump's steel and aluminum tariffs.

Like Canada, it pointed out that any negotiations over these tariffs are separate from the ongoing NAFTA talks.

The renegotiation process for NAFTA "follows its course independently of this or any domestic policy measure taken by the US government," the Mexican Economy Ministry said in a statement.

"Mexico reiterates that the negotiation of NAFTA should not be subject to conditions outside the process," it added.

Mexico is the fourth biggest supplier of steel to the US, accounting for 9.3% of total imports, according to S&P Global Platts.

US goods trade with Mexico was worth nearly $560 billion last year.

-- Steven Jiang, Nanlin Fang, Jake Kwon, Charles Riley, Yoko Wakatsuki, Patrick Gillespie and Julia Horowitz contributed to this report.