United Nations members have reached an agreement on how countries should tackle climate change.
Delegates have approved a framework for setting national pledges to be submitted to a summit next year.
Differences over the draft text caused the talks in Lima, Peru, to overrun by two days.
Environmental groups have criticised the deal as a weak and ineffectual compromise, saying it weakens international climate rules.
The talks proved difficult because of divisions between rich and poor countries over how to spread the burden of pledges to cut carbon emissions.
The BBC’s Matt McGrath in Lima says none of the 194 countries attending the talks walked away with everything they wanted, but everybody got something.
There was a great sense of relief among delegates when the announcement came in the early hours of Sunday morning, he adds, following 48 hours of talks without a break.
Peru’s environment minister, Manuel Pulgar-Vidal, who chaired the summit, told reporters: “As a text it’s not perfect, but it includes the positions of the parties.”
The agreement was adopted hours after a previous draft was rejected by developing countries, who accused rich nations of shirking their responsibilities to fight global warming and pay for its impacts.
The final draft is said to have alleviated those concerns with by saying countries have “common but differentiated responsibilities”.