UN members on the eve of a global summit backed a plan on Tuesday for nursing Earth's sick environment back to health and tackling poverty through greener growth.
But relief at avoiding a repeat of the deadlocked 2009 Copenhagen climate summit mingled with disappointment for many who thought the deal was a sad compromise.
"Nobody in that room adopting the text was happy. That's how weak it is. And they all knew," the European Union's commissioner for climate change, Connie Hedegaard, said in a tweet.
After haggling that went deep into the night, national delegates gave provisional approval to a 53-page statement designed to act as a compass for sustainable development for the next decade and beyond.
It identifies measures for tackling the planet's many environmental ills and lifting billions out of poverty through policies that nurture rather than squander natural resources.
The community of nations will vow to "ensure the promotion of economically, socially and environmentally sustainable future for our planet and for present and future generations."
The draft is expected to be endorsed by world leaders on Friday to close the 10-day Conference on Sustainable Development, the 20-year followup to the landmark Earth Summit.
Ninety-two heads of state of government are expected to make speeches, with deputy leaders or ministers standing in for most of the others.
As summit host, Brazil battled to avoid asking leaders to sort out gridlocked text -- a scenario that brought the Copenhagen Summit to the brink of catastrophe.
One of the biggest areas of dispute was on "Sustainable Development Goals," or SDGs, that will replace the UN's Millennium Development Goals after these objectives expire in 2015 and on promoting the green economy.
Efforts by the European Union (EU) for text to shore up the environmental quality of the SDGs when they are negotiated in detail fell through.
Developing countries, too, failed to get any figures in paragraphs about financing sustainable growth for poorer economies. The Group of 77 and China bloc had demanded $30 billion a year.
"We have a text that has been agreed 100 percent by the 193 (UN) parties," Brazilian Foreign Minister Antonio Patriota told reporters.
"It amounts to a victory for multilateralism... after 20 years, the spirit of Rio remains alive."
The United States was also positive.
"I think it was a good strong step forward," US Climate Change Envoy Todd Stern told reporters. "I think the outcome that we finished today will help advance goals in this area."
Others, though, said the deal was only a starting point on a long road.
German Environment Minister Peter Altmaier said he was "not 100 percent satisfied," but "after the failure of Copenhagen it is a sign of encouragement... it was very important to avoid failure at this conference."
French Development Minister Pascal Canfin sounded a similar note.
"We are not completely satisfied, but we avoided Rio+20 turning into Rio minus 20," he said.
His colleague, Ecology Minister Nicole Bricq, said there were numerous pluses in the text, and these could be improved upon in the future.
"EU pressure has helped us to jam a foot in the door and stop it from being slammed shut," Bricq said.
The US green group, the Natural Resources Defense Council, was upbeat about the deal's potential benefit for the seas but criticized it for failing to beef up environmental governance, an area of jealously-guarded national sovereignty.
"The positive steps contained in the text on plastic pollution, ocean acidification, fishing subsidies and overfishing -- if vigorously implemented -- will help reverse the decline of our oceans," the director of its international program, Lisa Speer, said.
On the sidelines, 50,000 activists, business executives and policy-makers are attending the conference.
The summit will be attended by President Francois Hollande of France and President Jacob Zuma of South Africa alongside Prime Ministers Manmohan Singh of India and Wen Jiabao of China.
But US President Barack Obama, British Prime Minister David Cameron and German Chancellor Angela Merkel will be absent.
And Russia will be represented by its head of government, Dmitry Medvedev, not President Vladimir Putin as expected, according to the official list of speakers.