ANKARA - A series of diplomatic wins, capped by the deal to resume Ukraine's grain exports, provides some respite for President Tayyip Erdogan from Turkey's economic strife and offers a blueprint of his campaign strategy for elections due next year.

As he prepares for what is shaping up to be the biggest electoral challenge of his nearly 20-year rule, the president is playing up his achievements on the global stage.

"Turkey is going through its strongest period politically, militarily and diplomatically," he told a crowd of thousands of people in northwest Turkey at the weekend, a day after holding talks in Russia with President Vladimir Putin.

Progress internationally contrasts with a grim economic picture at home, with inflation soaring to 79% and the lira languishing near record lows it hit during the most recent currency crisis in December.

Opponents blame Erdogan's unorthodox economic policies, including a series of interest rate cuts despite high inflation and the sacking of three central bank governors since 2019, that have left the country running large current account deficits and reliant on external financing to support the economy.

Erdogan said the fruits of the government's economic policies - prioritising exports, production and investment - would become clearer in the first quarter of 2023.

INTERNATIONAL STANDING

In the meantime, government officials and senior members of his ruling AK Party portray the president as a statesman standing against electoral rivals who are nowhere near matching his international credentials.

"Whether you like him or not, Erdogan is a leader," a senior Turkish official said, arguing that no other international figure had the same level of contact with top global players. "There is no leader in Turkey who can replace him."

The accord to restart exports from Ukraine, cut off since Russia's February invasion, could ease grain shortages which have left millions of people vulnerable to hunger and driven up global prices.

Brokered by the United Nations and Turkey, it came after Erdogan secured concessions from NATO over the accession of Nordic countries and initiated a rapprochement with rival powers in the Middle East.

Erdogan also won a pledge in June from U.S. President Joe Biden that he would support the sale of F-16 fighters jets to Turkey, after Washington blocked Ankara from buying more advanced F-35 jets because of its purchase of Russian weaponry.

ELECTION TEST

The longest-serving ruler and most-dominant political figure since Mustafa Kemal Ataturk founded modern Turkey nearly a century ago, Erdogan faces parliamentary and presidential elections that must be held by June 2023.

A survey by pollster Metropoll last week found a slight rise in support for his AK Party to 33.8%, still comfortably the most for any single party. But he faces a loose alliance of opposition parties, and polls show him trailing opposition presidential candidates.

Topping voter concerns are the state of the economy, and the presence of 3.6 million Syrian refugees, welcomed by Turkey at the start of Syria's conflict but increasingly seen by Turks as competitors for jobs and services.

"The government is using foreign policy as material to cover up the economic disaster it has dragged the country into, telling tales of 'diplomatic victory' at home," said Erdogan Toprak, a lawmaker from the main opposition CHP and senior adviser to its leader Kemal Kilicdaroglu.

Toprak said that even on the diplomatic front, Erdogan was making concessions that "damage the dignity of our country and drag it into weakness".

REPAIRING REGIONAL TIES

Erdogan, who survived huge anti-government protests in 2013 and a coup attempt in 2016, has sought to repair strained ties with other Middle Eastern powers, partly in the hope of attracting badly needed foreign funds.

Turkey is hoping for a deal with Saudi Arabia, and has made moves to improve relations with Egypt and Israel.

"Voters are aware of the benefits of diplomacy. At times they will complain about the economy or refugees, but they will vote for Erdogan for the continuation of an effective Turkey," an AK Party official said.

Key to Erdogan's diplomacy in the Middle East and beyond is what he called his "joint understanding, based on mutual trust and respect" with Putin - a relationship causing growing concern among Turkey's NATO partners since Russia invaded Ukraine.

Russia says it is waging a "special military operation" to rid Ukraine of nationalists and protect Russian-speaking communities.

Turkey has sought to strike a balance by criticising the Russian invasion and providing Ukraine with arms, while refusing to join the West in imposing sanctions on Russia - a stance it says has helped its mediation efforts reap results.

"By securing the opening of the grain corridor we confirmed again Turkey's key role in solving global problems," Erdogan said on Saturday.

(Reporting by Orhan Coskun and Daren Butler; Writing by Daren Butler and Dominic Evans; Editing by Alex Richardson)