Silvio Berlusconi, the Italian prime minister, said there was a "common will" to see that this would be prevented through a "significant reduction" in the emission of greenhouse gases by 2050.
The deal, however, was described by Ban Ki-moon, the UN secretary-general, as "not sufficient".
Ban said in a statement that the deal should be backed by medium-term measures to prevent the catastrophic impact of climate change.
"The commitments expressed today at the G8 and Major Economies Forum (MEF) leaders' meeting, while welcome, are not sufficient," Ban said in a statement.
"The countries represented at L'Aquila are responsible for more than 80 per cent of global emissions, and that is why they bear special responsibility for finding a solution to the political impasse," he said.
"If they fail to act this year, they will have squandered a unique historical opportunity that may not come again."
Scientists have repeatedly warned that if the world's average temperature rises by more than 2C when compared to their pre-industrial levels, it will cause catastrophic changes to global weather patterns, triggering widespread storms, flooding, droughts and famines.
The world's most powerful trading nations also called on Thursday for an immediate restart of the stalled Doha round of World Trade Organisation talks with a view to reaching a deal in 2010.
"We are setting a deadline of 2010 for concluding the Doha round [on world trade]," Gordon Brown, the British prime minister, said on the sidelines of the G8 meeting extended to the world's biggest emerging nations.
Brown praised the US and India over the agreement to put aside the differences which sank a deal last year.
"For us to get this agreement ... is a reflection of the policy that the US administration is taking and the willingness of countries like India to come to an agreement," he said.
|The Group of Five includes India, Mexico, Brazil, South Africa and China [AFP]
At the summit of G8 leaders with the Group of Five (G5) major rising economies and Egypt, leaders announced that trade ministers would meet before a G20 summit in Pittsburgh, US, in September to re-start negotiations.
The Doha talks, which are meant to stimulate development by liberalising trading rules, started in 2001 but reached a deadlock in July 2008 when the US and India failed to agree over "special safeguard mechanisms" limiting agricultural trade.
"Almost everything had been agreed [last year] but we couldn't get agreement on the special safeguards mechanism," Brown said.
A statement approved by the leaders of the "G8+5+1" group in L'Aquila called for an "an ambitious and balanced conclusion for the Doha Development Round in 2010."
The only leader not present at the summit was Hu Jintao, the Chinese president. He had been set to attend, but flew home to confront ethnic riots in Xinjiang.
The leaders are now believed to have committed $15bn over three years to support agricultural investment in poorer countries and reduce food insecurity.
According to the United Nations, the number of malnourished people now exceeds one billion.
In a draft statement the G8 summit kept its commitment to ensuring adequate emergency food assistance, but its focus on agricultural investments reflected a new emphasis on longer-term strategies to fight hunger.
The leaders said their approach would target increased agriculture productivity, stimulus to harvest interventions, emphasis on private sector growth, women and smallholders, preservation of natural resources, job expansion, training and increased trade flows.
The $15bn over three years announced compares with $13.4bn which the G8 says it has disbursed between January 2008 and July 2009 for global food security.