Erdogan becomes Turkey's first executive president after winning more than half the votes, election officials say.
Recep Tayyip Erdogan has won the country's key presidential vote, electoral officials have said, in a result that will allow him to keep his seat with increased powers and become Turkey's first executive president.
With 97.7 percent of ballots counted, Erdogan received on Sunday more than half the votes required to secure an outright victory, Sadi Guven, the head of the Supreme Election Committee (YSK), told reporters in the capital, Ankara.
Earlier, state-run Anadolu news agency had reported that Erdogan's share of the vote stood at 52.5 percent.
"Our democracy has won, the people's will has won, Turkey has won," Erdogan told a crowd of enthusiastic supporters in the capital, Ankara, thanking the Turkish citizens who cast their ballots in an election that saw a record turnout of 87 percent.
The 64-year-old also declared victory for the People's Alliance, a bloc between his ruling Justice and Development Party (AK Party) and the Nationalist Movement Party (MHP), saying they had won a parliamentary majority in the legislative elections, also held on Sunday.
Before heading to Ankara, Erdogan, who has ruled Turkey for more than 15 years as prime minister and president, had also addressed a crowd of cheering, flag-waving supporters from the top of a bus in the country's largest city of Istanbul.
"I thank God for showing us this beautiful day," Ahmet Dindarol, 35, told Al Jazeera, as he joined in the celebrations in front of the AK Party headquarters in Istanbul.
"We elected Recep Tayyip Erdogan as the first executive president of Turkey. We prayed so much for him," he added.
"Things will get better from now on. There will be less bureaucracy and more investments. The foreign powers who are playing games on Turkey's economy got their response," he said.
Erdogan's closest rival, Muharrem Ince, of the main opposition Republican People's Party (CHP), received 30.8 percent of the votes, according to Anadolu.
He was followed by Selahattin Demirtas, of the pro-Kurdish Democratic People's Party (HDP), at 8.1 percent and debutante right-wing IYI (Good) Party's Meral Aksener, at 7.4 percent.
All three major opposition parties accused Anadolu of manipulating the results and releasing them selectively, a claim dismissed by the government.
"I hope nobody will try to cast a shadow on the results and harm democracy in order to hide their own failure," Erdogan said in his speech.
Official results are to be announced in a few days.
More than 56 million voters were eligible to cast their ballots in the elections, which were brought forward by more than 18 months by the AK Party-controlled parliament in April.
The voting marked the first time Turkish voters cast their ballots in simultaneous presidential and parliamentary elections, in line with the constitutional changes approved in a referendum last year that will transform the country's parliamentary system to an executive presidential one.
The new system is set to hand the next president significant executive powers, as well as abolish the prime ministry and remove the monitoring role of parliament, among others.
In the new era, the presidential office will have the power to appoint vice presidents, ministers, high-level officials and senior judges. The president will also be able to dissolve parliament, issue executive decrees, and impose a state of emergency.
On the parliamentary front, Erdogan's AK Party got 42.4 percent of the votes, while its far-right MHP secured 11.2 percent.
The two parties are predicted to claim 293 and 49 seats in the 600-member parliament respectively, with almost all of the ballot boxes opened, according to Anadolu. Erdogan was their joint presidential candidate.
A majority of 360 votes in parliament are required to take a constitutional change to referendum in the new executive presidential system.
The opposition CHP and IYI parties, along with the ultraconservative Felicity Party (SP), formed the diverse Nation Alliance to challenge Erdogan in the parliamentary polls.
According to Anadolu, the CHP acquired 22.7 percent of the ballots, while its ally, IYI Party got 10.1 percent. They are expected to have 146 and 45 seats in parliament.
The pro-Kurdish HDP is set to secure 66 seats after receiving 11.1 percent.
"The AK Party got around 42 percent of the votes, while Erdogan got around 52 percent. That 10 percent apparently came from his ally, MHP," Mustafa Akyol, a Turkish columnist and analyst, told Al Jazeera.
"The results show that the AK Party-MHP alliance will have to continue for Erdogan to carry out his executive presidency comfortably," he said.
"This makes the MHP an important party for the AK Party and Erdogan," added Akyol. "It gives it a lot of power."
Akyol also underlined that the fact that Ince secured a significantly higher percentage as a presidential candidate than the CHP in the parliamentary polls - about eight percentage points higher - "might open the way for him to become" the main opposition party's chairman.
Erdogan entered the race in the face of a depreciating lira and straining relations with the West amid an ongoing state of emergency.
The state of emergency has been in place since July 2016 following a failed deadly coup blamed by the government on the movement of Fethullah Gulen, a US-based self-exiled religious leader.
Turkey's Western allies have repeatedly condemned the Turkish government's detentions and purges after the coup attempt.
Local and international rights groups accuse the government of using the coup bid as a pretext to silence opposition in the country.
Erdogan's government says that the purges and detentions are in line with the rule of law and aim to remove Gulen's supporters from state institutions and other parts of society.
Erdogan delivering a statement on national television from his official residence in Istanbul [AP]