The deal was reached with nearly 200 countries at 7.40pm – more than 24 hours after the two-week summit was scheduled to finish.
The Cop26 climate talks have agreed to get countries to strengthen their emissions-cutting targets for 2030 by the end of next year in a bid to limit dangerous warming.
Ministers and negotiators at the UN summit in Glasgow have also sent a signal on the shift away from the world's dirtiest fuel, with a deal calling for efforts to escalate the "phase down" of unabated coal, as well as the phasing out of inefficient fossil fuel subsidies.
However, the Glasgow Pact was watered down at the last minute - following a push by India and China - from escalating the "phase out" of unabated coal, to "phase down", prompting angry responses from European and vulnerable countries.
But it is the first explicit mentions of fossil fuels in a UN climate agreement.
The deal aims to keep limiting global warming to 1.5C above pre-industrial levels "alive" or within reach, in the face of a huge gap between the action countries are taking and what is needed to meet the goal.
‘I apologise for way process unfolded’
In the wake of the "Glasgow Pact" being gavelled through - more than 24 hours after the official finishing time of the conference, there were warnings that the 1.5C goal was "on life support".
Many island states, including the representative for Fiji, criticised the last-minute change on coal.
He told delegates: "What we would like to express was not just our astonishment but our immense disappointment in the manner in which this has been introduced."
‘Pulse is weak’
He said days before they were warned against making "last-minute" changes to the text and said "due process" had not been followed.
COP26 President Alok Sharma said: “I apologise for the way this process has unfolded.”
Concluding the conference he said: “We can now say with credibility that we have kept 1.5 degrees alive.
"But, its pulse is weak and it will only survive if we keep our promises and translate commitments into rapid action.”
But Climate activist Greta Thunberg tweeted: “The #COP26 is over. Here’s a brief summary: Blah, blah, blah.
“But the real work continues outside these halls. And we will never give up, ever.”
First Minister Nicola Sturgeon expressed her dismay at the weakened stance on coal.
She said: “There is recognition for the first time, although it is deeply disappointing that due to last minute interventions by China and India it is not as strong and clear as it should be, of the need to reduce reliance on fossil fuels, a journey Scotland has already embarked on - and needs to accelerate - in a way that is fair and just.
“The Glasgow Climate Pact does not contain everything that every country wanted and there is understandable disappointment that key issues were watered down in the final hours, but there can be no doubt that the Glasgow summit has made progress on some important issues.
‘Fragile planet hanging by a thread’
“There have been significant commitments to double finance for adaptation, to take action on methane and deforestation and the beginning of proper recognition of the loss and damage that is being experienced by countries particularly in the global south.
“While there has been much positive progress, there is no escaping the fact that COP26 has not delivered as much as global south countries, activists and campaigners rightly demanded and I firmly believe that the leaders of the rich developed countries must go further.
“In particular, the failure to close the gap and deliver the $100 billion commitment in full was not a lack of funds but a lack of political will."
UN secretary general Antonio Guterres said the approved texts from Cop26 were a compromise that took important steps, but the "collective political will was not enough to overcome some deep contradictions".
He warned: "Our fragile planet is hanging by a thread. We are still knocking on the door of climate catastrophe."
‘Exit lane on road to hell’
He called for an end to fossil fuels subsidies, a phase out of coal, a price on carbon, building resilience of vulnerable communities against the impacts of climate change and to make good on the long-promised $100bn climate finance commitment to support developing countries.
He said: "We did not achieve these goals at this conference.
"But we have some building blocks for progress."
Professor Dave Reay, director of Edinburgh Climate Change Institute at the University of Edinburgh, said the conference had “created an exit lane on the road to hell”.
He said: “COP26 was always going to be a spaghetti junction on the road towards realising the Paris climate goals.
"That the negotiators have managed to successfully navigate so many political jams and drafting dead ends is a triumph in itself.
"From multilateral action on deforestation and methane emissions, through consensus on the urgency of adapation, finance and addressing 'loss and damage', to a sharper ratchet for national emissions cuts, there has been some real progress over the last two weeks.
"Make no mistake, we are still on the road to hell, but Glasgow has at least created an exit lane.”
Prime Minister Boris Johnson said: "Today's agreement is a big step forward and, critically, we have the first ever international agreement to phase down coal and a road map to limit global warming to 1.5 degrees."
But Labour leader Sir Keir Starmer said: "Glasgow has been a missed opportunity - a summit too often of climate delay not climate delivery"
Scottish Greens co-leader Patrick Harvie said: “The failure of governments to deliver an agreement that puts the planet on course for a 1.5C rise is shameful.
“The influence of fossil fuel companies is clear. We know that fossil fuel companies had more representation at this summit than any single nation, and the outcome has reflected that."
Friends of the Earth Scotland said the COP26 agreement would be remembered as the “Glasgow get-out clause” because rich countries had again “shirked their responsibility and put the world on track for a rise in climate pollution and further devastation”.
‘It’s meek, it’s weak’
Head of campaigns Mary Church said: "COP26 will be remembered as a historic failure to close the gap on 1.5C.
"Countries including the UK, the US and the EU are failing to cut climate pollution fast enough, failing to deliver the finance they owe countries already bearing the brunt of climate breakdown, and instead spending their energy inventing loopholes and get out clauses to avoid taking action."
Greenpeace International executive director Jennifer Morgan said: “It’s meek, it’s weak and the 1.5C goal is only just alive, but a signal has been sent that the era of coal is ending. And that matters.
“While the deal recognises the need for deep emissions cuts this decade, those commitments have been punted to next year.
"Young people who’ve come of age in the climate crisis won’t tolerate many more outcomes like this.
“Glasgow was meant to deliver on firmly closing the gap to 1.5C and that didn’t happen, but in 2022, nations will now have to come back with stronger targets.
"The only reason we got what we did is because young people, Indigenous leaders, activists and countries on the climate front line forced concessions that were grudgingly given.
"Without them, these climate talks would have flopped completely."
Stop Climate Chaos Scotland said rich countries had not gone anywhere near far enough on specific commitments to reduce emissions to limit temperature rise to 1.5C.
Chair Tom Ballantine said: “World leaders arrived at COP26 knowing this summit needed to be a turning point in tackling the climate crisis, but instead of committing to the emissions cuts needed to keep temperature rises below 1.5 degrees, they again ‘kicked the can down the road’.”
WWF Scotland director Lang Banks said: “We came into Glasgow expecting actions to keep 1.5 alive, and we leave with that ambition still within reach – but only just.
"Much more still needs to be done, but with agreement on several key issues, such as the critical role nature can play and on curbing the use of coal and fossil fuel subsidies, and with countries now required to return next year with improved plans, there is still hope.”