Negotiators in Poland have finally secured agreement on a range of measures that will make the Paris climate pact operational in 2020.
Last-minute rows over carbon markets threatened to derail the meeting - and delayed it by a day.
Delegates believe the new rules will ensure that countries keep their promises to cut carbon.
The Katowice agreement aims to deliver the Paris goals of limiting global temperature rises to well below 2C.
"Putting together the Paris agreement work programme is a big responsibility," said the chairman of the talks, known as COP24, Michal Kurtyka.
"It has been a long road. We did our best to leave no-one behind."
The common rulebook envisages flexibility for poorer nations.
Developing countries seek recognition and compensation for the impact of rising temperatures.
The idea of being legally liable for causing climate change has long been rejected by richer nations, who fear huge bills well into the future.
Last weekend, scientists and delegates were shocked when the US, Saudi Arabia, Russia and Kuwait objected to the meeting "welcoming" a recent UN report on keeping global temperature rise to within the 1.5C limit.
The report said the world is now completely off track, heading more towards 3C this century.
Keeping to the preferred goal would need "rapid, far-reaching and unprecedented changes in all aspects of society".
Representatives from 196 states took part in the talks. They were trying to sort out some very tricky questions about the rulebook of the Paris agreement.
These are the regulations that will govern the nuts and bolts of how countries cut carbon, provide finance to poorer nations and ensure that everyone is doing what they say they are doing.
It sounds easy but is very technical. Countries often have different definitions and timetables for their carbon cutting actions.
Poorer countries want some "flexibility" in the rules so that they are not overwhelmed with regulations that they don't have the capacity to put into practice.
Courtesy: BBC