Northvolt, a Swedish maker of batteries for electric cars, said on Thursday that it would build a factory near Montreal after the Canadian government matched financial incentives that would have been available from the United States.

The company will invest $5 billion in the factory, which will employ as many as 3,000 people and be among the largest battery plants in North America when it begins production in 2026.

The Inflation Reduction Act, President Biden’s signature climate law, includes billions of dollars in incentives to create a domestic battery industry. It has sparked a boom in investment as well as fierce competition among government officials seeking to lure companies to their states or provinces.

U.S. allies have complained that incentives designed to create a domestic supply chain have ignited a costly subsidy arms race.

Canada’s federal government and Quebec’s provincial government will each provide $1 billion in subsidies for the project, effectively matching the incentives that Northvolt would have received had it decided to build a plant in the United States, said Paolo Cerruti, a founder of the company.

“Canada is mirroring those measures pretty much one to one,” Mr. Cerruti, a former Tesla executive who will oversee the factory, said in an interview.

Northvolt was also drawn to the site, in McMasterville and Saint-Basile-le-Grand, Quebec, because of the region’s ample hydropower as well as mines that could eventually supply lithium and other raw materials, Mr. Cerruti said. A lithium mine near La Corne, Quebec, about 350 miles northwest of Montreal, began operations this year.

“We would like to have as much lithium as possible from Canada,” Mr. Cerruti said.

Northvolt markets itself as a sustainable battery producer that aims to minimize greenhouse gas emissions and other environmental damage caused by its factories. The site in Quebec will also include a recycling center that Northvolt says will eventually yield half of the lithium, cobalt, nickel and other raw materials required for electric car batteries.

Mr. Cerruti said Northvolt had lined up customers for the Quebec plant, but he declined to name them. In Europe, Northvolt makes batteries for carmakers including BMW, Volkswagen and Volvo. The company’s main factory is in northern Sweden, and it is building a factory near Hamburg that will receive subsidies from the German government.

In April, Volkswagen said it would invest about $5 billion to build a battery factory in St. Thomas, Ontario, which will also benefit from government financing.