Greece's parliament has narrowly approved a new batch of austerity measures, including thousands of public-sector job cuts and transfers, demanded by the country's creditors to keep vital bailout loans flowing.

MPs backed the cutbacks in an article-by-article vote early on Thursday morning, with two of the governing coalition's 155 deputies failing to back crucial articles.

It was the first major test for conservative prime minister Antonis Samaras since a left-wing party abandoned his coalition government last month.

The legislation will put 12,500 public-sector staff, mostly teachers and municipal workers, in a programme that subjects them to involuntary transfers and possible dismissals. It will also pave the way for 15,000 layoffs by the end of next year.

City halls across the country have been closed this week, with uncollected rubbish piling up on the streets, and unions held a general strike on Tuesday against the proposed cuts.

"I fully understand the hardship the Greek people are going through during the great crisis," the finance minister, Yannis Stournaras, said during the debate. "But I am fully convinced that the path we have chosen is correct."

About 3,000 people protested outside parliament in central Athens ahead of the vote, chanting anti-austerity slogans in a third straight day of protests.

But the reaction in the midst of the summer holiday season was subdued compared with previous, often violent demonstrations that brought tens of thousands into the streets.

Germany's finance minister, Wolfgang Schaeuble, arrives in Athens on Thursday for a visit planned amid security measures that Greece's left-wing main opposition party denounced as "fascist and undemocratic".

The measures include a ban on all demonstrations in the city centre, including the area outside parliament that has been the focus of past violent protests.

The 13-month-old coalition government claims it has already made progress in stabilising the shattered economy. On Wednesday, Samaras made a televised statement to announce a sales tax cut for restaurant and catering services from 23% to 13% – the first tax reduction since the crisis began in late 2009.

Samaras is due to hold talks with Schaeuble, who is expected to discuss German support for small and medium-sized Greek businesses. And on Sunday, he will meet US treasury secretary Jacob Lew, who will stop in Athens on his way back from a G20 meeting in Moscow.

Schaeuble, widely resented in Greece as the driving force behind the country's painful cutbacks, said his one-day trip was meant to display confidence in Greek efforts at recovery.

"I can well understand people in Greece it's just that we have to help Greece get on a better path," he told Germany's ARD television on Wednesday evening. "The only thing that will really help people in Greece is achieving better economic development, they are on the right track ... it will continue to pay off."

But public sector staff targeted in the cuts said there was no justification for their treatment.

Sitting on the hot asphalt under an umbrella during a protest on Wednesday, 47-year-old Maria Denida joined other women who travelled from the northern city of Thessaloniki to protest outside parliament, together with many of the country's mayors.

"I've been a school guard for 13 years and suddenly we find out we have no job. They say we'll be suspended. But that means we'll be fired," Denida said.

Municipal police officers from around Greece rallied in the capital with their motorcycles and patrol cars. The force, whose duties include monitoring street vendors and parking, is due to be disbanded and incorporated into national police after officers are suspended on reduced pay for up to eight months.

"We cannot understand why this is happening," union head Apostolos Kossivas said. "We asked the government if there was any financial gain – they said no. Did we provide a bad service? They said no."

"So we think they just wanted to make up the quota they needed for job cuts, and are proceeding without a plan," Kossivas said.