By Amanda Coletta

TORONTO — For decades, Canada's military has been considered a weak link in NATO. Now, it is rushing to rearm.

In the past year, Canada has met its North Atlantic Treaty Organization spending target of 2% of gross domestic product ahead of schedule. Canadian Armed Forces recruitment has also reached a 30-year high, and the country has begun acquiring billions of dollars in new military hardware. On Monday, Canada said it would buy up to 12 new submarines in an overhaul of its aging fleet.

"In a more dangerous and divided world, Canada must do more to defend ourselves, secure our sovereignty and support our allies," Prime Minister Mark Carney said Monday on the eve of the NATO summit, as he announced that the country had entered into negotiations with a German-Norwegian group led by ThyssenKrupp Marine Systems for the submarines in the largest military procurement in Canadian history.

"The assumptions that shaped decades of Canadian defense and foreign policy have been upended," he added. "History is back with a vengeance."

It is a remarkable turnaround for a founding NATO member that has drawn scorn from successive U.S. presidents and other allies for not pulling its weight. Not long ago, the country's military brass warned that Canada couldn't lead a NATO battle group and respond to other crises at the same time, and they halted all nonessential activity to respond to a severe personnel shortage.

The expansion of military spending comes amid trade and geopolitical tensions with the Trump administration. Carney said last year that "the long-held view that Canada's geographic location will protect us is becoming increasingly archaic." He has said Canada's underinvestment in military readiness had left it vulnerable to the U.S., which "is beginning to monetize its hegemony, charging for access to its markets and reducing its relative contributions to our collective security."

Since becoming prime minister last year, Carney has promised to raise Canada's military spending to levels not seen in more than half a century. That marks a significant pivot from the approach of his predecessor, Justin Trudeau, who called NATO's spending target a "crass mathematical calculation" that doesn't "actually make us automatically safer" and said Canada wouldn't meet it until 2032.

Canada now meets NATO's spending level of 2% of GDP and has promised to meet NATO's new target of 5% of GDP by 2035. Canada boosted pay to service members and last year set up a new defense-investment agency to accelerate procurement.

Its 2025 budget promises to spend $60 billion over the next five years to rebuild the armed forces, and this year it unveiled a new defense-industrial strategy that aims to award defense contracts to domestic firms and increase Canada's military exports by 50%. It is also looking to diversify its military purchases away from the U.S.

To that end, Canada this year became the first non-European country to join Europe's defense procurement pact. It entered talks with Sweden's Saab to acquire surveillance aircraft to help detect and deter threats in the Arctic, spurning U.S. suppliers. And last month it signed a deal with Australia to buy a $1.76 billion over-the-horizon radar system, also for the Arctic.

Critics argue that there has been a lack of transparency on how this money will be allocated or on the trade-offs that such a massive increase in military spending will entail. Even as Canada met NATO's minimum level of defense spending in the most recent year, it lags behind many of its allies. Only a handful of the alliance's 32 members spend less.

Elbridge Colby, the Pentagon's undersecretary of defense for policy, rebuked Canada in May, saying that the country had "failed to make credible progress on its defense commitments." He said in a series of posts on social media that the U.S. would be suspending its participation in a joint Canada-U.S. defense board that was set up in 1940.

Still, Canada's defense spending commitments haven't gone unnoticed, and leaders and companies from around the world have been eager to cash in. The Swedish royal family paid a rare visit to Canada last year as part of the country's effort to pitch Saab's Gripen jet fighters as an alternative to Lockheed Martin's F-35s. Canada announced last year that it was reviewing a 2023 deal to buy up to 88 of the U.S. jets, citing the geopolitical environment.

Competition for the submarine contract has been similarly fierce. South Korea's HD Hyundai Heavy Industries and Hanwha Ocean and Germany's ThyssenKrupp Marine Systems sought to woo Canadian officials with promises, including using Canada's critical minerals and steel — an industry threatened by President Trump's tariffs — in their supply chains. The U.S. doesn't manufacture the diesel electric submarines Canada was procuring.

Despite having the world's longest coastline, Canada has only had one operational submarine.

Kerry Buck, who served as Canada's ambassador to NATO from 2015 to 2018, said that Canada's military shortfalls and its failure to meet the alliance's spending targets was becoming "increasingly difficult at NATO" and was hurting its leverage. She said the submarine announcement, made on the eve of the NATO summit in Turkey, shows Canada can procure "fast and at scale."

"That's an important signal of credibility and commitment," she said.

Write to Amanda Coletta at amanda.coletta@wsj.com