Climate talks in Poland ended in compromise on Saturday.
After 30 hours of deadlock, delegates on Saturday adopted a modified text for consideration at a summit in Paris in 2015. An all-night session on Friday failed to produce a deal.
The BBC reports an agreement was achieved after a series of last minute compromises often involving single words in draft texts.
Green groups earlier said there was a significant risk of the talks collapsing.
Negotiators from developing countries wanted to ensure that the UN had a major role in determining how deep the cuts in carbon emissions should be in any new agreement.
However, the United States, European Union and others wanted to make sure that decisions on cuts remain in national hands.
Environmental groups walked out of the talks on Thursday in protest at lack of progress. It was the first time that they had staged such a coordinated walkout.