Turkish voters had for the first time cast ballots for both president and parliament in the snap polls, with Erdogan looking for a first-round knockout and an overall majority for his ruling Justice and Development Party (AKP).
The stakes in this election are particularly high as the new president is the first to enjoy enhanced powers under a new constitution agreed in an April 2017 referendum strongly backed by Erdogan.
Erdogan was on course to defeat his nearest rival Muharrem Ince with more than half the vote without needing a second round, initial results showed.
"The unofficial results of the elections have become clear. According to these... I have been entrusted by the nation with the task and duties of the presidency," Erdogan said at his Istanbul residence.
Turkey elections 2018: Understanding the political parties
He added that the alliance led by the AKP had won the majority in parliament.
Erdogan has just under 53 per cent in the presidential poll while Ince, of the secular Republican People's Party (CHP), was on 31 per cent, state-run Anadolu news agency said, based on a 96 per cent vote count.
The figures could yet change as final ballot boxes are opened.
But celebrations were already beginning outside Erdogan's residence in Istanbul and AKP headquarters in Ankara, with crowds of flag-waving supporters, AFP correspondents said.
Trailing were Meral Aksener of the nationalist (Iyi) Good Party with over seven per cent and Selahattin Demirtas of the pro-Kurdish Peoples' Democratic Party (HDP) with almost eight per cent.
A count of almost over 95 per cent for the parliamentary election also showed that Erdogan's AKP -- along with its Nationalist Movement Party (MHP) allies -- were well ahead and set for an overall majority.
The pro-Kurdish Peoples' Democratic Party (HDP) was polling 11 per cent, well over the 10 per cent minimum threshold needed to win 46 seats, which would make it the second largest opposition party in the new chamber.
Turkish police detain 47 suspected coup supporters
Turnout in the presidential election was almost 88 per cent, according to the figures published by Anadolu.
Erdogan had faced an energetic campaign by Ince, who has rivalled the incumbent's charisma and crowd-pulling on the campaign trail, as well as a strong opposition alliance in the legislative poll.
Ince vowed to spend the night at the headquarters of Turkey's election authority in Ankara to ensure a fair count and urged supporters to stay in polling stations until the final vote was counted.
The CHP said it had recorded violations in particular in the southeastern province of Sanliurfa, although Erdogan insisted, after voting himself, there was no major problem.
"I will protect your rights. All we want is a fair competition. Have no fear and don't believe in demoralising reports," Ince said after polls closed.
Several world leaders supportive of Erdogan, including Azerbaijani President Ilham Aliyev and Qatari Emir Tamim bin Hamad Al-Thani, called to congratulate him on his "victory", the presidency said.
Erdogan has overseen historic change in Turkey since his Islamic-rooted ruling party first came to power in 2002 after years of secular domination. But critics accuse the Turkish strongman, 64, of trampling on civil liberties and autocratic behaviour.
Turkey elections 2018: Understanding the political parties
Although Erdogan dominated airtime on a pliant mainstream media, Ince finished his campaign with eye-catching mass rallies, including a mega-meeting in Istanbul on Saturday attended by hundreds of thousands of people.
The president has for the last two years ruled under a state of emergency imposed in the wake of the 2016 failed coup, with tens of thousands arrested in an unprecedented crackdown which cranked up tensions with the West.
Erdogan, whose mastery of political rhetoric is acknowledged even by critics, has won a dozen elections but campaigned against the backdrop of increasing economic woes.
Inflation has zoomed well into double digits -- with popular concern over sharp rises in staples like potatoes and onions -- while the Turkish lira has lost some 25 per cent in value against the US dollar this year.
From Ataturk to Erdogan: Five things to know about modern Turkey
But the opposition has lambasted the uneven nature of the poll, which saw state-controlled television ignore Ince's giant rally in Istanbul on the eve of the election.
And in a situation labelled as blatant unfairness by activists, the HDP's Demirtas has campaigned from a prison cell after his November 2016 arrest on charges of links to outlawed Kurdish militants.
After casting his ballot in his jail in the northwestern region of Edirne, Demirtas wrote on Twitter: "I wish that everyone uses their vote for the sake of the future and democracy of the country."
COMMENTS (3)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ