Tayyip Erdogan and his ruling AK Party claimed victory in Turkey's presidential and parliamentary polls on Sunday, overcoming the biggest electoral challenge to their rule in a decade and a half.

The main opposition party did not immediately concede defeat. But after initially saying Erdogan would fall well short of a first-round victory, it said it would continue its democratic struggle "whatever the result".

"Our people have given us the job of carrying out the presidential and executive posts," Erdogan said in a short national address as votes were still being counted.

"I hope nobody will try to cast a shadow on the results and harm democracy in order to hide their own failure," he added, clearly aiming to pre-empt opposition complaints of foul play.

Erdogan, 64, the most popular but also the most divisive politician in modern Turkish history, later waved to cheering, flag-waving supporters from the top of a bus in Istanbul.

Sunday's vote ushers in a powerful new executive presidency long sought by Erdogan and backed by a small majority of Turks in a 2017 referendum. Critics say it will further erode democracy in the NATO member state and entrench one-man rule.

Erdogan's victory paves the way for another five-year term. Under the new constitution, he could serve a further term from 2023, taking him to 2028.

An unexpectedly strong showing by the AK Party's alliance partner, the nationalist MHP, could translate into the stable parliamentary majority that Erdogan seeks in order to govern freely.

"This sets the stage for speeding up reforms," Turkish Deputy Prime Minister Mehmet Simsek tweeted of the results.

The lira, which has lost about a fifth of its value against the dollar this year, firmed more than 1 percent in early trading in Asia on hopes of a stable working relationship between the president and parliament. It reached 4.587 lira to the dollar at 12:17 a.m. (2117 GMT) before easing slightly.

OPPOSITION DOUBTS

Erdogan's main presidential rival, Muharrem Ince of the main opposition Republican People's Party (CHP), urged election monitors to remain at polling stations to help ensure against possible election fraud, as final results came in from large cities where his party typically performs strongly.

With 99 percent of votes counted in the presidential race, Erdogan had 52.5 percent, well ahead of Ince's 31 percent, broadcasters said.

The opposition raised doubts about the accuracy and reliability of the figures released by state-run Anadolu news agency, the sole distributor of the official vote tally.

But an opposition platform collating its own vote tally from monitors based at polling stations around the country broadly confirmed the Anadolu figures.

Opposition parties and NGOs had deployed up to half a million monitors at ballot boxes to try to prevent possible electoral fraud. They said election law changes and fraud allegations in the 2017 referendum raised fears about the fairness of Sunday's elections.

Erdogan said there had been no serious voting violations.

In Sunday's parliamentary contest, the Islamist-rooted AK Party won 42 percent and its MHP ally 11 percent, based on 99 percent of votes counted, broadcasters said.

In the opposition camp, the CHP had 23 percent and the pro-Kurdish Peoples' Democratic Party (HDP) 11 percent - above the threshold it needs to reach to enter parliament. The opposition nationalist Iyi (Good) party received 10 percent.

Election turnout nationwide was very high at around 87 percent for both contests, the state broadcaster said.

Erdogan argues that his new powers will better enable him to tackle the nation's economic problems and crush Kurdish rebels in southeast Turkey and in neighbouring Iraq and Syria.

Investors would welcome the prospect of a stable working relationship between the president and the new parliament, although they also have concerns about Erdogan's recent comments suggesting he wants to take greater control of monetary policy.

Erdogan has declared himself an "enemy of interest rates", raising fears he will pressure the central bank to cut borrowing costs after the election despite double-digit inflation.

He brought forward the elections from November 2019, but he faced an unexpectedly feisty challenge from Ince, a former physics teacher and veteran CHP lawmaker, who galvanized Turkey's long-demoralised and divided opposition.

Turkey held Sunday's elections under a state of emergency declared after a failed military coup in July 2016 that Erdogan blamed on his former ally, U.S.-based Muslim cleric Fethullah Gulen.

It limits some freedoms and allows the government to bypass parliament with decrees, although Erdogan says he will soon lift the measure.

Since the coup attempt, Erdogan has waged a sweeping crackdown on Gulen's followers in Turkey, detaining some 160,000 people, according to the United Nations.

Critics, including the European Union, which Turkey still nominally aspires to join, say Erdogan has used the crackdown to stifle dissent. He says his tough measures are needed to safeguard national security.