UN climate talks have closed with an agreement that the chair said had "saved tomorrow, today".
The European Union will place its current emission-cutting pledges inside the legally-binding Kyoto Protocol, a key demand of developing countries.
Talks on a new legal deal covering all countries will begin next year and end by 2015, coming into effect by 2020.
Management of a fund for climate aid to poor countries has also been agreed, though how to raise the money has not.
Talks ran nearly 36 hours beyond their scheduled close, with many delegates saying the host government lacked urgency and strategy.
Nevertheless, there was applause in the main conference hall when South Africa's International Relations Minister, Maite Nkoana-Mashabane, brought down the long-awaited final gavel.
"We came here with plan A, and we have concluded this meeting with plan A to save one planet for the future of our children and our grandchildren to come," she said.
"We have made history."
The conclusion was delayed by a dispute between the EU and India over the precise wording of the "roadmap" for a new global deal.
India did not want a specification that it must be legally binding.
Eventually, a Brazilian diplomat came up with the formulation that the deal must have "legal force", which proved acceptable.
The roadmap proposal originated with the EU, the Alliance of Small Island States (Aosis) and the Least Developed Countries bloc (LDCs).
They argued that only a new legal agreement eventually covering emissions from all countries - particularly fast-growing major emitters such as China - could keep the rise in global average temperatures since pre-industrial times below 2C (3.6F), the internationally-agreed threshold.
"If there is no legal instrument by which we can make countries responsible for their actions, then we are relegating countries to the fancies of beautiful words," said Karl Hood, Grenada's Foreign Minister, speaking for Aosis.
"While they develop, we die; and why should we accept this?"
Delegates from the Basic group - Brazil, South Africa, India and China - criticised what they saw as a tight timetable and excessive legality.
"I stand firm on my position of equity," said an impassioned Jayanthi Natarajan, India's environment minister.
"This is not about India, it is about the entire world."
India believes in maintaining the current stark division where only countries labelled "developed" have to cut their greenhouse gas emissions.
Western nations, she said, have not cut their own emissions as they had pledged; so why should poorer countries have to do it for them?
Xie Zhenhua, head of the Chinese delegation, agreed.
Apparently trembling with rage, he berated the developed countries: "We are doing things you are not doing... we want to see your real actions".
However, Bangladesh and some other developing countries weighed in on the side of Aosis, saying a new legally-binding deal was needed.
Aosis and the LDCs agree that rich countries need to do more.
But they also accept analyses concluding that fast-developing countries such as China will need to cut their emissions several years in the future if governments are to meet their goal of keeping the rise in global average temperature since pre-industrial times below 2C.
Once the roadmap blockage had been cleared, everything else followed quickly.
There were some surreal moment of confusion, but few objections, except from members of the Latin American Alba group, who said the developed world was not living up to its promises.
A management framework was adopted for the Green Climate Fund, which will eventually gather and disburse finance amounting to $100bn (£64bn) per year to help poor countries develop cleanly and adapt to climate impacts.
There has also been significant progress on Reducing Emissions from Deforestation and forest Degradation (REDD).
Environment groups were divided in their reaction, with some finding it a significant step forward and others saying it had done nothing to change the course of climate change.
Many studies indicate that current pledges on reducing emissions are taking the Earth towards a temperature rise of double the 2C target.
Michael Jacobs, visiting professor at the Grantham Research Institute on Climate Change and the Environment in London, said the agreement could bring real changes.
"The agreement here has not in itself taken us off the 4C path we are on," he said.
"But by forcing countries for the first time to admit that their current policies are inadequate and must be strengthened by 2015, it has snatched 2C from the jaws of impossibility.
"At the same time it has re-established the principle that climate change should be tackled through international law, not national, voluntarism."