But it stopped short of urging numerical targets reducing greenhouse emissions.
"Leaders of the world's major economies, both developed and developing, commit to combat climate change in accordance with our common but differentiated responsibilities and respective capabilities," it said.
India and China dismissed the rich nations' call for them to halve emissions by 2050.
The BBC's Roger Harrabin at the summit says China felt that emerging economies were being implicitly asked to take responsibility for a problem caused mainly so far by the West.
On Tuesday, the G8 - which includes the UK, US, Canada, France, Germany, Italy, Japan and Russia - restated its "vision" of halving harmful emissions by 2050.
But Mexico, Brazil, China, India and South Africa challenged developed countries to cut their greenhouse emissions by more than 80% by 2050.
Leading environmentalist R K Pachauri discusses the summit outcome
Japanese Prime Minister Yasuo Fukuda said the G8 leaders had demonstrated they were serious about tackling climate change.
"It is the very first time ever that leaders of the major economies have got down to vigorous discussions on a broad range of climate-change-related issues, and I believe that the leaders have shown strong political will," he said.
On food and energy costs, Mr Fukuda said:
"The rising food and oil prices add to inflationary pressures, and will therefore raise serious challenges to growth and would have a serious impact on the most vulnerable."
During the summit, G8 leaders also called for UN sanctions against Zimbabwe's leadership, because of violence during the controversial re-election of President Robert Mugabe last month.
The US and the UK are pressing for a travel ban and assets freeze on Mr Mugabe and his senior allies, and an arms embargo.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.