OTTAWA — In a decision that marked an important victory for Prime Minister Justin Trudeau’s climate change agenda, Canada’s Supreme Court ruled that the federal government’s imposition of carbon taxes in provinces that oppose them was constitutional.

Citing Parliament’s power to legislate on matters related to “peace, order and good government,” the court said that fighting climate change by reducing greenhouse gas emissions was a matter of “national concern” protected under the Constitution.

“This matter is critical to our response to an existential threat to human life in Canada and around the world,” the court wrote in its 6-to-3 decision. “Climate change is real. It is caused by greenhouse gas emissions resulting from human activities and it poses a grave threat to humanity’s future.”

The concept of carbon pricing has been widely endorsed by economists and, according to the World Bank, some form of it has been carried out or is in development in 64 countries, either through direct taxes on fossil fuels or through cap-and-trade programs.

Setting minimum carbon prices as a way to reduce emissions and encourage efficiency is a cornerstone of Mr. Trudeau’s climate change program. During the 2015 election campaign that first brought him to power, Mr. Trudeau emphasized the need for provinces to implement carbon pricing, an approach opposed by his Conservative predecessor, Stephen Harper.

Several U.S. states have carbon pricing programs, notably California. Money and tax credits to address climate change are expected to underpin much of President Biden’s coming spending proposals, which aides and documents suggest could cost as much as $4 trillion over the next decade.

But several people familiar with the forthcoming infrastructure package in the United States said that there are no plans currently to price carbon emissions. Instead, the president plans to greatly raise fuel efficiency standards for cars, forcing automakers toward electric vehicles through regulation, not legislation. Similarly, Mr. Biden plans to reimpose strict emissions regulations on electric power plants to move the sector away from coal.

Republicans in Congress remain firmly opposed to a carbon tax and have voted repeatedly and nearly unanimously over the years to bar the government from imposing one.

Like Republicans in the United States, conservative premiers in the oil-producing provinces of Alberta and Saskatchewan have long strenuously campaigned against carbon pricing. They were joined by Doug Ford, another Conservative, who canceled the carbon pricing program in Ontario shortly after he became premier of Canada’s most populous province in 2018.

Court challenges by those three provinces of Mr. Trudeau’s carbon pricing law ultimately led to the Supreme Court’s decision.

“We certainly would hope that this brings an end to the jurisdictional and partisan battle around climate action here in Canada,” said Keith Brooks, programs director at Environmental Defence, an advocacy group. “People, including premiers who don’t like carbon pricing, use it as a political wedge and to sow division but also misinformation.”

While the Supreme Court decision’s detailed the dangers of climate changes to Canada and its coastlines, Arctic region and Indigenous people in particular, none of the three provinces that started the legal challenges dispute its effects. Their objections instead focused on the argument that Mr. Trudeau’s program had overstepped the federal government’s constitutional powers.

In 2019, Mr. Trudeau set a minimum price for carbon. It will become 40 Canadian dollars a metric ton on April 1 and will reach 170 dollars a ton in 2030. Most provinces have their own programs to meet those targets, either through a direct charge on fuels and industry emissions or by setting a cap on emissions and then creating a marketplace for industries that exceed the limit to buy emission permits from other businesses who fall below the cap.

The federal government has only stepped in when a province, like Ontario under Mr. Ford, refused to price carbon. In those cases, it placed a tax on fuel and set other fees for industrial emissions.

Individual Canadians receive carbon tax rebates from the government to compensate for the surcharge on fuel. A review by Parliament’s budget watchdog found that most households are paid more in rebates than they spend on carbon taxes. Households can boost that bonus by further cutting emissions by using more efficient or electric vehicles or improving their heating systems.

Jason Kenney, the premier of Alberta, who canceled his province’s program, told reporters that he was disappointed with the decision but declined to say if his province will come up with a carbon pricing system to replace the federally imposed one. “We’re going to consult with Albertans and talk to our allied provinces to determine the best way forward,” he said.

The Supreme Court upheld the constitutionality of the law in part because the federal plan only kicks in if provinces do not set up their programs, thus maintaining the shared jurisdiction the two levels of government hold on environmental issues.

It also concluded that setting a single national minimum price for carbon is necessary for effectively reducing greenhouse gases, or GHGs, which makes federal involvement essential

“Addressing climate change requires collective national and international action,” the court wrote. “This is because the harmful effects of GHGs are, by their very nature, not confined by borders.”

Lisa Friedman contributed reporting from Washington, D.C.