The legislation approvs a cut in emissions of 75 per cent by 2030, a new target tougher than the 70 per cent reduction originally proposed by Scottish ministers.
Scottish media reports campaigners welcomed the passing of the new legislation, which was approved by 113 votes to zero with six abstentions.
However, Scottish Green MSPs refused to back the Climate Change (Emissions Reduction Targets)(Scotland) Bill, insisting that it did not go far enough.
Party climate spokesman Mark Ruskell said: “We won’t endorse a Bill that is pre-occupied with distant targets while doing nothing to deliver transformative action and does not go far enough for the critical period of the next ten years.“Time is running out and while the targets in this bill are eye-catching, they’re not backed by anything that suggests the status quo is really being challenged.
“When we look back at this bill in years to come we will see missed opportunities to drive strong progress, but there will be no time machine to call on.”
He added: “When I look at the enormity of the challenge we face, the worsening scientific picture, the risks we are taking with our children’s future, I am saddened and angry an opportunity to deliver real transformative change has been passed up.”
Media reports Ms Cunningham insisted it was “extraordinary” that the six Green MSPs had refused to back the bill, saying it sets “the most ambitious statutory targets of any country in the world”.
The Scottish parliament previously legislated to cut emissions in the Climate Change Act of 2009, with the environment secretary saying the new law “crucially increases the ambition of Scotland’s targets”.
She told MSPs: “Scotland is still the only country in the world to set legally binding annual targets to reduce greenhouse gas emissions.
“We were the first country to include a fair share of emissions from international air travel and shipping in our targets.
“Since 2009, three climate change plans have been brought with annual targets, with some being met and some missed.
“Crucially, Scotland’s emissions are now down by 47 per cent since the 1990 baseline.
“We’re already almost half way to reaching net zero emissions, and equally importantly, this progress has been achieved while growing the economy, increasing employment and productivity.”
The legislation was approved days after thousands of Scots took part in a global day of protest for more action on climate change.
Campaigners also gathered outside the parliament as the bill was being debated.
Tom Ballantine of Stop Climate Chaos Scotland said: “This bill sets a strong long-term target to reduce emissions to net-zero by 2045 and drive action in the crucial next decade.
“We were particularly pleased to see all parties coming together today to increase the 2030 target.”
He said the increased target of 75 per cent was included at the last minute “thanks to extensive public pressure, particularly the incredible youth-led climate marches last week”.
While he stated campaigners should “feel rightly proud” of this, the legislation was not the end of the process.
“It’s what comes next that will show whether Scotland is really serious about tackling this crisis,” Mr Ballantine said.
“Urgent action must follow, with these targets driving rapid and immediate action to move away from fossil fuels in our homes, transport and energy.”
The Liberal Democrats had been calling for a 75 per cent target to be adopted by 2030, but the Greens had said it should be 80 per cent.
Mr Ruskell said: “The climate strikers demand it, Stop Climate Chaos demands it, and the Scottish Greens have made it possible with our amendment for an 80 per cent target for 2030.
“The SNP have shown they can move on this, but they need to go further and match our ambition.”
A Citizens’ Assembly on Climate Change will be created to make recommendations to Ministers on how Scotland’s net-zero transition should be achieved.
Ministers will be required to report on progress to tackle climate change in every sector annually.