The UN climate change talks produced a modest deal today that for the first time commits all the major economies to reducing emissions, but not enough to meet their promise of keeping the global temperature rise to 2C.

The agreement, which took four years to negotiate, should help to prevent deforestation, promote the transfer of low-carbon technologies to developing countries and, by 2020, establish a green fund, potentially worth $100bn (£63bn) a year, to shield the more vulnerable countries from climate change.

However, governments failed to reach agreement on how far overall global emissions should be cut, and there are many loopholes for countries to avoid making the deep reductions that scientists say are needed.

Researchers from the Climate Action Tracker said the pledges would set the world on course for 3.2C warming – a catastrophe for many of the poorest countries. But the deal was greeted enthusiastically by Chris Huhne, Britain's energy secretary. "This is way better than what we were expecting only a few weeks ago. This is a significant turning point. It clearly says that there should be reductions from developing countries. It takes us forward to a legally binding overall outcome," he said.

He added that it would give industry more confidence to invest in low-carbon economies and would encourage Europe to commit to a 30% cut in emissions by 2020.

By the end of the conclusive round of exchanges, which began at around 7pm local time on Friday night and did not end until after 3am yesterday morning, the only resistance to a deal came from Bolivia, which said UN decisions had been taken without consensus. "This is a hollow and false victory that was imposed without consensus, and its cost will be measured in human lives," the country's ambassador, Pablo Solon, said.

He was unmoved by the cheering in the plenary hall for the agreement, saying: "They are thinking like politicians. The experts that know about climate change, they know that we are right. This agreement won't stop temperature from rising by 4C and we know that 4C is unsustainable."

Until the final hours, the deal had seemed elusive, with Japan and then Russia refusing to sign up to a second commitment period to the Kyoto protocol. But Connie Hedegaard, the European Union's climate commissioner, said there was a powerful motivation among countries to avoid a repeat of the much-hyped summit at Copenhagen, which failed to yield an agreement.

World leaders including Britain's David Cameron, Germany's Angela Merkel and Mexico's Felipe Calderón telephoned the Japanese prime minister to plead for him to change his position. In the end, lawyers found a form of words that allowed Japan to avoid making new pledges until later.

America, which had also taken a hard line, also ended up with a win. It entered the talks saying it would not endorse nearly completed deals on deforestation or climate finance unless China and India subjected their emissions pledges to an inspection regime.

Todd Stern, the state department climate change envoy, said the deal at Cancún had given substance to the notion of an inspections regime, which were raised at Copenhagen. But by his own admission, and that of campaigners, Cancún represented only incremental progress.

Brazil's environment minister, Izabella Texeira, said she was glad the talks had managed to find a compromise to maintain Kyoto beyond 2012. "We believe the protocol is the essential key to making a meaningful full impact on climate change," she said.

"Cancun may have saved the [UN]process but it did not yet save the climate," said Greenpeace International Climate Policy Director Wendel Trio.

"With lives on the line, we must now build on this progress. Long term funding must be secured to help vulnerable countries protect themselves," said Oxfam director Jeremy Hobbs.

Friends of the Earth International called the agreement a slap in the face, and warned that it could still lead to a temperature rise of 5C. "In the end, all of us will be affected by the lack of ambition and political will of a small group of countries. The US, with Russia and Japan, are to blame for the lack of desperately needed greater ambition," said Nnimmo Bassey, Friends of the Earth's international director.

But Stern and Hedegaard pushed back against the idea that the countries had led political expediency trump scientific necessity.

"If you look at at what we have to do in the next year you can see ithat there is a very heavy work programme but it is definitely not as if we only agreed on process and then left the substance for Durban. There are lots of substantial issues that have been solved here," she said.

Other measures agreed in outline included the setting up next year of a major climate fund panel to administer and deliver the billions needed for the developing world to adapt to climate change. In a concession to developing countries, this will be largely run by developing countries and not the World Bank.