WASHINGTON — The Trump administration said on Thursday that it would impose steep tariffs on metals imported from its closest allies, provoking retaliation against American businesses and consumers and further straining diplomatic ties tested by the president’s combative approach.

The European Union, Canada and Mexico, which will face 25 percent tariffs on steel and 10 percent on aluminum, quickly denounced the action and drew up lists of tit-for-tat measures, many aimed at parts of the United States where President Trump enjoys his strongest political support.

The move follows months of uncertainty as the Trump administration dangled potential exemptions for allies in return for concessions on other fronts. In moving forward with tariffs on national security grounds, the administration now faces a crucial test of whether its aggressive strategy will extract promises from trading partners or end up backfiring on the United States economy.

The tariffs “have already had major, positive effects on steel and aluminum workers and jobs and will continue to do so long into the future,” White House officials said in a statement. “At the same time, the Trump administration’s actions underscore its commitment to good-faith negotiations with our allies to enhance our national security while supporting American workers.”