By Jeff Mason

KRUEN, Germany (Reuters) - President Barack Obama said the United States and Germany were "inseparable allies" and German Chancellor Angela Merkel described Washington as an essential partner on Sunday as the two leaders sought to put a recent spy row behind them.

Ties between the Cold War allies have deteriorated in the last couple of years due to revelations of widespread surveillance of German citizens, including Merkel's phone, by the U.S. National Security Agency (NSA).

But Obama endeared himself to the locals in Bavaria before a Group of Seven (G7) summit by using the traditional Bavarian greeting "Gruess Gott!" and highlighting Germany's accomplishments in a broad sweep of post-war history.

"My message to the German people is simple: we are grateful for your friendship, for your leadership," said Obama, standing beside Merkel and in front of rows of Germans drinking beer in the sunshine against the backdrop of the Alps.

"We stand together as inseparable allies in Europe and around the world."

Remarking that his home town of Chicago would not be the same without the influence of German immigrants, Obama said the fall of the Berlin Wall 25 years ago had "inspired the world."

"That fact that all of us are here today is proof that conflicts can end and great progress is possible," he said.

Obama and Merkel held bilateral talks before the meeting of G7 leaders in a luxury hotel at the foot of Germany's highest mountain, the Zugspitze.

Recent tensions between Germany and the United States boiled over last year, when Berlin told the U.S.'s top intelligence official in the embassy to leave over the spying scandal.

Like Obama, Merkel chose to accentuate the positive in the relationship between their countries, albeit in a lower key.

"Despite some differences of opinion we have today, the United States of America is our friend, our partner and such an essential partner that we cooperate closely because we need it and want it in our mutual interest," she said.

(Writing by Paul Carrel; Editing by Noah Barkin and Philippa Fletcher)