President Trump is imposing steep tariffs on steel and aluminum from three of America's biggest trading partners — Canada, Mexico and the European Union.

The trade penalties, 25% on imported steel and 10% on imported aluminum, take effect at midnight, Commerce Secretary Wilbur Ross told reporters Thursday.

Mexico, the EU and Canada immediately announced plans to retaliate with their own tariffs against American products.

Trump announced worldwide steel and aluminum tariffs in March but granted exemptions to some major trading partners.

Canada, Mexico and the EU were among the countries granted relief while the United States pursued negotiations to address the administration's concerns about the state of domestic steel and aluminum production. Those negotiations had a Friday deadline.

Related: The global steel industry by the numbers

Trump's decision could raise prices for Americans on a range of everyday products. It could also place the United States in a trade dispute on more than one front. The administration is separately moving ahead with tariffs on Chinese goods.

Trump imposed the steel and aluminum penalties under a 1962 law that gives the president broad power to increase or reduce tariffs on goods deemed critical to national security.

"We take the view that without a strong economy, you cannot have strong national security," Ross told reporters.

Trump's announcement lifted American steel and aluminum stocks because those companies stand to benefit from penalties against their foreign competitors. U.S. Steel climbed 3%. But the broader market sank because of trade war fears. The Dow fell about 200 points.

Mexico quickly said the US action was not justified, and vowed to retaliate with comparable penalties on American lamps, pork, fruit, cheese and flat steel.

Europe also said it would start the process for enacting retaliatory tariffs. It did not announce details, but the bloc has previously threatened 25% tariffs on US products such as motorcycles, denim, cigarettes, cranberry juice and peanut butter.

"Today is a bad day for world trade," EU trade commissioner Cecilia Malmström said in a statement. "We did everything to avoid this outcome."

Canadian officials said at a press conference that Canada would enact tariffs on $12.8 billion in US exports, effective July 1, to retaliate against Trump's action.

"Let me be clear," Prime Minister Justin Trudeau said. "These tariffs are totally unacceptable."

Foreign minister Chrystia Freeland called it "the strongest trade action Canada has taken in the post-war era."

Getting rid of the exemptions for Canada and Mexico could also complicate ongoing negotiations on NAFTA.

The NAFTA talks were one factor in the administration's decision to grant exemptions to Canada and Mexico from the steel and aluminum tariffs. But Ross said Thursday that those talks "are taking longer than we hoped."

In a statement late Thursday, Trump said a message had been conveyed to Trudeau earlier in the day that the United States "will agree to a fair deal, or there will be no deal at all."

Canada was the largest exporter of steel to the United States by value last year, according to data from Wood Mackenzie. Mexico was the third largest, behind South Korea.

The Trump administration said Tuesday that it is moving forward with tariffs on $50 billion worth of Chinese goods as punishment for intellectual property theft.

The Chinese government said the announcement was "obviously in violation of the consensus reached in Washington recently by both China and the United States." Both parties had previously said that tariffs would be put on hold as talks continued.

Related: Analysis: Trump's on-again, off-again strategy on China may backfire

Ross is scheduled to go to China this weekend for a third round of negotiations.

The United States is also exploring the possibility of putting new tariffs on cars. Last week, The Trump administration announced an investigation into whether automobile imports are hurting US national security, laying the groundwork for another trade fight.

Such an action could hurt Mexico, Canada, Germany and Japan.

— CNNMoney's Alanna Petroff, Nathaniel Meyersohn, Danielle Wiener-Bronner and Matt Egan contributed to this report.