German Chancellor Angela Merkel told Greece on Tuesday that the "tough path" of painful spending cuts will pay off, as tens of thousands protested in a show of anger against her visit to the eurozone's most indebted nation.

Police fired tear gas to disperse protesters in the Greek capital attempting to storm a barricade just blocks away from where Merkel was meeting with Greek Prime Minister Antonio Samaras, as small gangs of masked youths threw bottles at riot police.

While Merkel hailed the progress of reforms undertaken by Athens, 30,000 protesters brandishing banners reading "You are not welcome, Imperialisten Raus" (Imperialists out) or "No to the Fourth Reich", vented their anger against the budgetary discipline preached by the German leader.

Two Nazi flags were draped on a steel barricade near parliament and set on fire. During the protests, 24 people were arrested.

In the northern city of Thessaloniki, some 700 protesters also rallied outside the German consulate.

Vilified for the punishing spending cuts imposed in recession-hit Greece, Merkel, the head of the Europe's paymaster, was on her first visit to the country since the eurozone debt crisis erupted almost three years ago.

Merkel has become a hate figure in Greece over the austerity measures imposed on the country in return for promised loans and debt relief worth about 347 billion euros ($US448 billion).

She has even been depicted as Adolf Hitler in Greek tabloid caricatures.

On her first visit to Greece in five years, Merkel said: "I am deeply convinced that this tough path is worth it and Germany wants to be a good partner.

"A lot has been achieved. There is still a lot to do and Germany and Greece will work very closely together.

"These problems cannot be solved with one wave of a magic wand or one measure.... It will be a long way but I believe that we will see light at the end of the tunnel," Merkel said.

Samaras, a conservative who took office after elections in June, responded: "Greece is determined to keep its promises and overcome the crisis.... The Greek people are bleeding right now, but they are determined to win the battle of competitiveness."

Merkel's visit came at a crucial time for Athens, which is locked in negotiations with its international creditors over a 13.5-billion-euro package of more cuts in order to win further bailout funds.

'Pours oil on fire'

Berlin and Athens have both sought to sell Merkel's visit as a gesture of solidarity and encouragement for Greece's reform efforts, but many Greeks said the trip only served to fan anger.

Vana Koronaiou, a shop owner selling German-made handbags near Syntagma Square, said: "This visit pours oil on the fire.

"If she wanted to help, she should have done it sooner," she told AFP.

The belt-tightening has forced Greece into its fifth year of recession, with contraction of 3.8 percent forecasted for 2013.

About one in five people are unemployed in the country, and many of those who still have jobs have had their pay slashed.

Christina Vassilopoulou, a 37-year-old teacher, said she had turned up to protest "the decisions taken at European meetings where Merkel manipulates the participants".

"I have a doctorate and I make 900 euros a month, 400 less than before. We have children that go hungry and most of the parents are unemployed," she said.

Athina Kefala, a 57-year-old unemployed actress, complained that "the middle class and the newly impoverished are paying the country's debt.

"We are living an economic illusion with virtual money, and as a result we have nothing," she said.

Online hackers group Anonymous said it had attacked a number of Greek government sites.

"We, as Anonymous, are next to the Greeks claiming their freedom. We are next to a people who have fought against the German occupying forces," it said.

The German chancellor also met President Carolos Papoulias and a delegation of Greek and German businessmen before she flew back to Berlin in the evening.

Shortly before her arrival, Greece's international creditors -- the International Monetary Fund, European Union and European Central Bank -- piled further pressure on Athens to live up to its austerity pledges made in exchange for crucial loans.

Greece is counting on a positive outcome from the EU-IMF talks to unblock a 31.5-billion-euro installment from Greece's EU-IMF bailout package, which is needed to recapitalise banks and repay outstanding domestic debts in a country that is heading for a sixth straight year of recession.

Samaras said Friday that his country could not take more bitter medicine and warned that if the next aid tranche did not arrive soon, state coffers would be empty by November. Greece's debt amounted to about 160 percent of gross domestic product in 2011, according to official figures.

International creditors on Monday gave Athens an October 18 deadline -- the date of the next European Union summit -- to implement reforms in exchange for the next slice of the loan, which has been pending since June.

"We stressed that before the next disbursement, Greece clearly and credibly should demonstrate its commitment to fully implement the programme -- and 89 prior actions from March should be implemented by the 18th of October at the latest," Eurogroup chairman Jean-Claude Juncker said at the close of talks with finance ministers from the 17-nation single currency area.

AFP