The high-stakes presidential contest and a parliamentary election also held today were set to either consolidate Erdogan's grip on power or curtail his vast political ambitions.
The vote will complete Turkey's transition from a parliamentary to a new executive presidential system, a move approved in a referendum last year.
For an outright win in the presidential race, Erdogan needs more than 50 per cent of the vote to avoid a run-off on July 8.
With nearly 90 per cent of the country's ballot boxes counted, according to Anadolu, Erdogan was at 53.3 per cent of the vote, with his main rival Muharrem Ince at 30.4 per cent.
Kurdish candidate Selahattin Demirtas, who ran his campaign from jail where he is being held pending trial on terrorism-related charges, was garnering 7.7 per cent. He has called the charges trumped-up and politically motivated.
Erdogan supporters waving Turkish and party flags celebrated outside his residence in Istanbul.
In the parliamentary vote, with 88 per cent of ballot boxes counted, according to Anadolu, Erdogan's People's Alliance, which includes his Justice and Development Party, or AKP, and a small nationalist party, stood at 54.4 per cent, while the opposition Nation Alliance grouping together nationalists, secularists and a small Islamic-leaning party, was at 33.7 per cent.
The pro-Kurdish Peoples' Democratic Party, or HDP, was edging past the 10 per cent threshold to enter Parliament, with 10.7 per cent. If the HDP manages to get into Parliament, it could threaten Erdogan's AKP majority, meaning it will need support from another party to approve legislation.
HDP has seen nine of its lawmakers, including Demirtas, and thousands of party members jailed, and says more than 350 of its election workers have been detained since April 28.
Erdogan, 64, is seeking re-election for a five-year term with hugely increased powers under the new system, which he insists will bring prosperity and stability to Turkey, especially after a failed coup attempt in 2016 that has left the country under a state of emergency.
Ince, speaking just after polls closed, warned civil servants involved in the vote count to do their jobs "abiding by the law" and without fear, suggesting they were under pressure by the Government. He asked all Turks to be vigilant at polls and not be "demoralised" by what he called the possible manipulation of news.
Erdogan, who has been in power since 2003, has faced a more robust, united opposition than ever before. Opposition candidates had vowed to return Turkey to a parliamentary democracy with strong checks and balances and have decried what they call Erdogan's "one-man rule."
Erdogan is the most powerful leader since the founder of the Turkish republic, Mustafa Kemal Ataturk. He remains popular in the conservative and pious heartland, having empowered previously disenfranchised groups.
From a modest background himself, he has presided over an infrastructure boom that has modernised Turkey and lifted many out of poverty while also raising Islam's profile, for instance by lifting a ban on Islamic headscarves in schools and public offices.
But critics say he has taken an increasingly authoritarian bent. The election campaign was heavily skewed in his favor, with opposition candidates struggling to get their speeches aired on television. Erdogan directly or indirectly controls most of Turkey's media.
Five candidates were running against Erdogan in the presidential race.
Citing security reasons, authorities have relocated thousands of polling stations in predominantly Kurdish provinces, forcing some 144,000 voters to travel further to cast their ballots. Some will even have to pass through security checkpoints to vote.
The vote took place under a state of emergency declared after the failed coup attempt, which allows the government to curtail civil rights. Some 50,000 people have been arrested and 110,000 civil servants have been fired under the emergency powers, which opposition lawmakers say Erdogan is using to stifle dissent.
- AP