The goal is to agree to cut greenhouse gas emissions in half by 2050, Merkel said, hailing the decision as a "huge success." She said it came after many rounds of talks and negotiations on climate change.
Merkel, who has made the issue the centerpiece of her leadership of this year's G-8, had steadily lobbied fellow leaders on the matter since they began arriving in this Baltic Sea resort for their yearly summit.
"No one can escape this political declaration. It is an enormous step forward," she told reporters.
Details of the agreement were not immediately available, and it was unclear how much binding weight the declaration would carry since it is up to G-8 leaders to keep the promises they make.
A final summit communique was not expected until Friday
Merkel has long been calling for setting specific targets for reducing the carbon emissions believed to cause global warming, including a "two-degree" target under which global temperatures would be allowed to increase by no more than 2 degrees Celsius (3.6 degrees Fahrenheit) before being brought back down.
Experts have said that would require a global reduction in emissions of 50 percent below 1990 levels by 2050.
Merkel wanted binding reductions; President Bush opposed them. He instead proposed having the top 15 polluters meet and set a long-term goal, but decide for themselves how much to do toward meeting it.
Merkel, the summit host, said Thursday that the "toughest point was the halving of emissions ... that was the hardest step." But she said: "We agreed that we need reduction goals -- and obligatory reduction goals."
All parties agreed the process should take place within the U.N. framework and will begin with a meeting of environment ministers at a U.N. climate change conference in Bali, Indonesia, in December.
Earlier Thursday, British Prime Minister Tony Blair held out hope that world leaders would reach such an agreement despite differences between the U.S. and Europe over whether such cuts should be binding.
"I think that it is possible that we'll leave the summit with a commitment on the part of everyone to a substantial reduction of greenhouse gases by 2050 as a global target that is of the order of the type of figures the Europeans are talking about," said Blair, who leaves office June 27.
Blair was saying his goodbyes to Bush and other Group of Eight leaders in this seaside city in northern Germany.
Blair and Bush later joined six counterparts for the first working session of the G-8. Besides global warming, the leaders are tackling edgy relations with Russia and Moscow's opposition to Western efforts to secure independence for Serbia's Kosovo province, the crisis in Darfur, poverty aid to Africa, the Middle East and trade talks.
North Korea is likely to be another topic of discussion. The reclusive communist regime on Thursday fired short-range missiles off its western coast in an apparent test, according to South Korea's Defense Ministry.
The United States immediately denounced the launch, saying such activity was "not constructive" in the midst of a deadlock in international negotiations over North Korea's nuclear weapons program.
Merkel chaired the first working session, with Blair to her left and Bush next to him. Also at the table were Russia's Vladimir Putin, Italy's Romano Prodi, Canada's Stephen Harper, France's Nicolas Sarkozy, Japan's Shinzo Abe and Jose Manuel Barroso of the European Commission.
Afterward, Bush and Putin met privately after days of Cold War-style sparring over U.S. plans to base a missile defense shield in Poland and the Czech Republic, essentially in Russia's back yard.
Putin, bitterly opposed to placing such a system in Europe, told Bush that Russia would drop its objections and not seek to retrain its missiles on Europe if the shield were installed in Azerbaijan, a former Soviet satellite in central Asia.
Bush's national security adviser, Steve Hadley, called it an "interesting proposal."
Anti-poverty groups, meanwhile, hope the leaders will recommit to promises made during their summit two years ago in Gleneagles, Scotland, to increase international aid to Africa and other poorer countries.
In 2005, the G-8 agreed to increase the amount of aid by $50 billion a year through 2010, with half going to Africa. But since then, the pledge has missed the target by $30 billion, anti-poverty groups say.
This year's gathering is being held under tight security, with Heiligendamm sealed off by a seven-mile, razor wire-topped fence. Thousands of police have been deployed across the northern German region.
Protests continued Thursday for a second day, as demonstrators continued to block roads to Heiligendamm and police again resorted to firing water cannons to scatter them.
Offshore, Greenpeace environmental activists led police on a boat chase, with one boatload briefly spilling its contents into the Baltic.