Negotiations on the deal will begin immediately under a new group called the Ad Hoc Working Group on the Durban Platform for Enhanced Action.
The governments, including 35 industrialised countries, also agreed to extend the existing treaty on climate change prevention, the Kyoto Protocol, beyond the end of next year. They will be obliged to submit quantified emission limitation or reduction objectives for review by 1 May next year.
The Durban conference also agreed to take forward a package of measures to support developing nations in actions against climate change. They include a Green Climate Fund, to start operations next year, which will provide finance for clean energy and adaptation measures.
"We have taken crucial steps forward for the common good and the global citizenry today. I believe that what we have achieved in Durban will play a central role in saving tomorrow, today," said Maite Nkoana-Mashabane, president of the Durban conference.
Energy and climate change secretary Chris Huhne said: "This is a significant step forward in curbing emissions to tackle global climate change. For the first time we’ve seen major economies, normally cautious, commit to take the action demanded by the science. There are still many details to be hammered out, but we now need to start negotiating the new legal agreement as soon as possible."
But campaign group Friends of the Earth said the outcomes from the conference are too weak to prevent dangerous global warming, delaying action until after 2020 will fail to drive forward the low-carbon growth urgently needed to wean countries off fossil fuels, cut fuel bills and create jobs, it said.