Turkish President Recep Tayyip Erdogan lashed out at the German government on Saturday for criticising his call to ethnic Turks to vote against Germany's two ruling parties in September elections, warning the foreign minister to "know your limits".

The latest spat between Ankara and Berlin risks propelling a months-long crisis in ties between two NATO allies with deep historic links to a new level ahead of Germany's general election on 24 September.

Erdogan had a day earlier caused consternation in Berlin by urging ethnic Turks in Germany to vote against both parties in Chancellor Angela Merkel's governing coalition.

Analysts estimate that about 1.2 million people of Turkish origin will have the right to vote in the September elections.

But speaking to supporters in the southwestern province of Denizli, Erdogan launched a stinging personal attack on Gabriel.

"He knows no limits! Who are you to talk to the president of Turkey? Know your limits. He is trying to teach us a lesson... How long have you been in politics? How old are you?" Erdogan said.

Erdogan repeated his controversial call for ethnic Turks eligible to vote in the German elections not to cast their ballots for Merkel's Christian Democratic Union (CDU), their coalition partner the Social Democratic Party (SPD), or the Greens.

"Teach them a lesson in the German elections," he said. "They are waging a campaign against Turkey. Vote for those who don't have enmity towards Turkey."

He added: "It's not important for us whether Germany opens its doors to us or not. We have enough doors."

Tensions have increased between Germany and Turkey in recent months.

Berlin has lambasted Ankara over the magnitude of the crackdown that followed last year's failed coup, which has seen several German citizens arrested, including journalists.

Turkish-German journalist Deniz Yucel, the Istanbul correspondent of the Die Welt daily, has been jailed in Turkey since February ahead of trial on terror charges.

German journalist Mesale Tolu has been held on similar charges since May, while activist Peter Steudtner was arrested in a July raid.

Ankara meanwhile has accused Berlin of failing to extradite suspected Kurdish militants and coup plotters who have taken refuge in Germany.

Addressing Merkel as "Madam," Erdogan said the Turkish authorities had sent Germany dossiers on 4,500 suspects wanted for extradition to Germany on terror charges and received no answer.

"And she wanted one or two people to be sent home by me," he said in apparent reference to the detained journalists and activist. "Forgive me but you have your legal system and so do we," he added.

In a potential further bone of contention, Dogan Akhanli, a German writer of Turkish origin who has written extensively on Turkey's human-rights record, was arrested in Spain on Saturday at Ankara's request, Greens MP Volker Beck said. It was not clear why.

Turkey issued an Interpol arrest warrant for Akhanli with a so-called "Red Notice." His lawyer, Ilias Uyar, told Der Spiegel that he hasn't been granted access to his client and that the charges are unclear.

Any country can issue an Interpol "Red Notice," but Spain will only extradite Akhanli if Turkey can convince Spanish courts that there is a real case against the author, Deutsche Welle reported.

Another outrageous abuse of Interpol. This time by Turkey using a Red Notice to go after an Erdogan critic in Spain https://t.co/8KLRGyQ6SS

Earlier, Turkish Deputy Prime Minister Bekir Bozdag, who is also the official government spokesman, defended Erdogan's comments and said the reactions were "very disrespectful and very arrogant" and "beyond the bounds of decency".

Gabriel's SPD - whose candidate for the chancellorship is ex-EU parliament speaker Martin Schulz - and Merkel's CDU are rivals in the election.

But they have been in broad agreement on the policy regarding Turkey within the country's grand coalition.