The election could grant Erdogan, 69, a new five-year term or unseat him in favor of the head of an invigorated opposition, Kemal Kilicdaroglu, who has promised to return Turkey to a more democratic path.
If no candidate receives more than 50% of the vote, the race will be determined in a May 28 run-off.
Voters also elected lawmakers to fill Turkey's 600-seat parliament, which lost much of its legislative power under Erdogan’s executive presidency.
If his political alliance wins, Erdogan could continue governing without much restriction. The opposition has promised to return Turkey's governance system to a parliamentary democracy if it wins both the presidential and parliamentary ballots.
Opinion surveys indicated the increasingly authoritarian leader entered the election trailing a challenger for the first time. Erdogan has ruled Turkey as prime minister or president since 2003.
Pre-election polls gave a slight lead to Kilicdaroglu, 74, the joint candidate of a six-party opposition alliance who leads the center-left, pro-secular Republican People’s Party, or CHP.
Voting began at 8 a.m. (0500 GMT) and polls closed at 5 p.m. (1400 GMT). Under Turkey’s election custom, news organizations are barred from reporting partial results until an embargo lifts at 9 p.m. (1800 GMT). There are no exit polls.
More than 64 million people, including 3.4 million overseas voters, were eligible to vote in the elections, which come the year the country will mark the centenary of its establishment as a republic.
Voter turnout in Turkey is traditionally strong, reflecting citizens' continued belief in democratic balloting.
Yet Turkey has seen the suppression of freedom of expression and assembly under Erdogan, and it is wracked by a steep cost-of-living crisis that critics blame on the government’s mishandling of the economy.
Turkey is also reeling from the effects of a powerful earthquake that caused devastation in 11 southern provinces in February, killing more than 50,000 people in unsafe buildings.
Erdogan’s government has been criticized for its delayed and stunted response to the disaster, as well as a lax implementation of building codes that exacerbated the casualties and misery.
Internationally, the elections were being watched closely as a test of a united opposition’s ability to dislodge a leader who has concentrated nearly all state powers in his hands.
Erdogan has led a divisive election campaign, using state resources and his domineering position over media to woo voters.
He has accused the opposition of colluding with “terrorists,” of being “drunkards” and of upholding LGBTQ+ rights, which he claims are a threat to traditional family values.
In a bid to secure support from citizens hit hard by inflation, he has increased wages and pensions and subsidized electricity and gas bills, while showcasing Turkey’s homegrown defense and infrastructure projects.
He also extended the political alliance of his ruling Justice and Development Party, or AKP, with two nationalist parties to include a small leftist party and two marginal Islamist parties.
Kilicdaroglu’s six-party Nation Alliance has pledged to dismantle an executive presidential system narrowly voted in by a 2017 referendum and return the country to a parliamentary democracy.
They have promised to establish the independence of the judiciary and the central bank, institute checks and balances and reverse the democratic backsliding and crackdowns on free speech and dissent under Erdogan.
The alliance includes the nationalist Good Party led by former Interior Minister Meral Aksener, a small Islamist party and two parties that splintered from the AKP, one led by a former prime minister, Ahmet Davutoglu, and the other by a former finance minister, Ali Babacan.
The country’s main Kurdish political party, currently Turkey’s second-largest opposition grouping, is supporting Kilicdaroglu in the presidential race. Erdogan's government in recent years has targeted the party's leaders with arrests and lawsuits.
People were seen walking to schools acting as polling stations on a warm spring day in much of the country, and forming long lines outside classrooms. Officials in Ankara said they expected turnout to be even higher than previous years.
The lines were partly due to problems many voters encountered trying to fold bulky ballot papers, they featured 24 political parties competing for seats in parliament, and to fit them into envelopes along with the ballot for the presidency.
“It’s important for Turkey. It's important for the people,” Necati Aktuna, a voter in Ankara, said. “I’ve been voting for the last 60 years. I haven’t seen a more important election that this one.”
Large crowds gathered outside the polling stations where Erdogan and Kilicdaroglu cast their votes.
“We have all missed democracy so much. We all missed being together,” Kilicdaroglu said after voting at a school in Ankara, where his supporters chanted “President Kilicdaroglu!"
“From now on, you will see that spring will come to this country," he said.
Erdogan said voting was underway “without any problems,” including in the earthquake-affected region where people were voting “with great enthusiasm and love.”
"It is my hope that after the evening's count ... there will be a better future for our country, our nation and Turkish democracy," he said.
Also running for president was Sinan Ogan, a former academic who has the backing of an anti-immigrant nationalist party.
Another candidate, center-left politician Muharrem Ince, dropped out of the race on Thursday following a significant drop in his ratings, the country's election board said his withdrawal was invalid and votes for him would get counted.
Some have expressed concerns over whether Erdogan would cede power, if he lost. Erdogan, however, said in an interview with more than a dozen Turkish broadcasters on Friday that he came to power through democracy and would act in line with the democratic process.
Aksener, the Good Party leader, appealed for respect after she cast her vote.
“Now we are moving to the stage where we must all respect the results that emerge from the ballot boxes where people have voted freely and (with) their conscience,” she said.
Balloting in the 11 provinces affected by the earthquake, where nearly 9 million people were eligible to vote, has raised concerns.
Around 3 million people have left the quake zone for other provinces, but only 133,000 people registered to vote at their new locations.
Political parties and non-governmental organizations planned to transport voters by bus but it was not clear how many made the journey back.
Many of the quake survivors cast votes in containers turned into makeshift polling stations erected on school yards.
In Diyarbakir, a Kurdish-majority city that was hit by the earthquake, Ramazan Akcay arrived early at his polling station to cast his vote.
“God willing it will be a democratic election,” he said. “May it be beneficial in the name of our country.”
Short link: