Commentators began writing Erdogan's political obituary when his Islamic-rooted ruling party lost its outright majority in June elections for the first time since it swept to power over a decade ago.
From Attaturk to Erdogan: Turkey marks its 92nd Republic Day
But the combative Erdogan's gamble on calling snap elections for November 1 paid off handsomely, with the Justice and Development Party (AKP) that he co-founded regaining its majority.
Just two weeks after that triumph, Erdogan will roll out the red carpet in the Mediterranean resort of Antalya on Sunday for leaders of the world's top 20 economies including US President Barack Obama, Xi Jinping of China and Vladimir Putin of Russia.
The timing of the summit just after the elections is the perfect chance for Erdogan to show he is a key global player, in particular in dealing with the conflict in neighbouring Syria and the ensuing influx of 2.2 million refugees onto Turkish territory.
It also allows him to play the role of genial host and dampen criticism that his rule is creeping towards authoritarianism after raids on critical media and arrests of opponents.
"This G20 summit gives Erdogan the opportunity to reaffirm Turkey as an essential partner on the global scene," said Sinan Ulgen, chairman of the Istanbul-based Center for Economics and Foreign Policy Studies (EDAM) and a visiting scholar at Carnegie Europe in Brussels.
"He will for sure also take advantage of it personally to present himself as a world leader, despite all the criticism of his more and more authoritarian rule," he told AFP.
Turkey has in recent years felt aggrieved and even betrayed by the West over Syria, complaining it has received no help in hosting the refugees or in its aim to topple President Bashar al-Assad.
Erdogan, notoriously hot-tempered in private, has taken such disappointments as a personal slight and will be expecting Turkey's position to be taken fully into account at its G20.
Divided G20 seeks harmony on Syria at Turkey summit
Erdogan will look for promises that the West is still committed to ousting Assad, despite Russia's air campaign to bolster his regime.
He will also want reassurance the United States does not plan to arm Kurdish militia groups battling Islamic State militants in northern Syria.
"Erdogan will use the G20 summit as an opportunity to convince other heads of state that Assad must go and that support for Kurdish fighters in Syria must be kept to a minimum," said Max Abrahms, professor of political science at Northeastern University and a member at the US Council on Foreign Relations think-tank.
Erdogan, who became premier in 2003 and then Turkey's first directly elected president in 2014, was initially hailed in the West as leader of a country where Islam and democracy can co-exist.
But in a toughly worded progress report, the European Union chastised Turkey this week for backsliding on rule of law, rights and the media, which was labelled by the government as "unfair."
Aykan Erdemir, former MP from the secular opposition CHP party and non-resident senior fellow at Washington-based Foundation for Defence of Democracies, said the West would overlook Turkey's "dismal human rights record" in return for cooperation on major Middle Eastern issues.
Erdogan: Turkey's abrasive 'Sultan'
"Erdogan's main takeaway from the G20 would be to show to his supporters that Turkey has enough leverage to afford to be illiberal and that this would hurt neither the country's image nor the economy," he told AFP.
Having emerged stronger out of the latest vote, Erdogan is now seeking a powerful presidency with full executive powers to further tighten his grip on the country.
Analysts say the Antalya summit would show a domestic audience -- who may one day vote in a referendum for a switch from parliamentary to a presidential system -- that Erdogan is an internationally recognised leader.
"That's a good signal to send to the domestic audience that there's nothing to fear, he's a well-accepted player on the international scene," said Ali Carkoglu, professor of political science at Istanbul's Koc University.
"It's going to work very well for him."
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ