Delegates at the UN climate change conference in Cancun, Mexico produced a draft text late on Friday aimed at cutting CO2 emissions.
The text, which needs the approval of 193 countries, states global warming must be limited to less than two degrees by 2020.
The idea is to end a standoff between rich and poor countries about how to tackle the problem.
It also proposes a Green climate fund to manage 100 billion dollars (75 billion euros) pledged last year in Copenhagen to help developing nations.
As diplomats brokered deals late into the night, tempers flared outside the conference hall.
Scuffles broke out between UN security staff and a group of activists calling themselves the ‘Youth Movement against Climate Change.’
The activists had been demonstrating outside the summit venue but anger spilled over when police decided to move them on.