Watch: Erdoğan victory speech: 'Today nobody has lost'
"The entire nation of 85 million won," he told cheering crowds outside his enormous palace on the edge of Ankara.
But his call for unity sounded hollow as he ridiculed his opponent Kemal Kilicdaroglu - and took aim at a jailed Kurdish leader and pro-LGBT policies.
The opposition leader did not explicitly concede victory.
Complaining of "the most unfair election in recent years", Mr Kilicdaroglu said the president's political party had mobilised all the means of the state against him.
President Erdogan ended with just over 52% of the vote based on near-complete unofficial results - almost half the electorate in this deeply polarised country did not back his authoritarian vision of Turkey.
Ultimately Mr Kilicdaroglu was no match for the well-drilled Erdogan campaign, even if he took the president to a run-off second round for the first time since the post was made directly elected in 2014.
But he barely dented his rival's first-round lead, falling more than two million votes behind.
Watch: Kilicdaroglu gives fiery speech after Erdogan claims victory
The president made the most of his victory, with an initial speech to supporters atop a bus in Turkey's biggest city Istanbul, followed after dark by a balcony address from his palace to an adoring crowd that he numbered at 320,000 people.
"It is not just us who won, Turkey won," he declared, calling it one of the most important elections in Turkish history.
He taunted his opponent's defeat with the words "Bye, bye, bye, Kemal" - a chant that was also taken up by his supporters in Ankara.
Mr Erdogan poured scorn on the main opposition party's increase in its number of MPs in the parliament vote two weeks before. The true number had fallen to 129, he said, because the party had handed over dozens of seats to its allies.
He also condemned the opposition alliance's pro-LGBT policies - which he said was in contrast with his own focus on families.
Although the final results are not confirmed, the Supreme Election Council said there was no doubt who had won.
It is highly unusual for the palace complex to be opened to the public - but so was this result, extending his period in power to a quarter of a century.
Supporters came from all over Ankara to taste the victory. There were Islamic chants and some laid Turkish flags on the grass to pray.
For a night Turkey's economic crisis was forgotten and one supporter, Seyhan, said it was all a lie: "Nobody is hungry. We are very happy with his economy policies. He will do even better in the next five years."
But the president admitted that tackling inflation was Turkey's most urgent issue.
The question is whether he is prepared to take the necessary measures to do so. At an annual rate of almost 44%, inflation seeps into everyone's lives.
The cost of food, rent and other everyday goods has soared, exacerbated by Mr Erdogan's refusal to observe orthodox economic policy and raise interest rates.
The Turkish lira has hit record lows against the dollar and the central bank has struggled to meet surging demand for foreign currency.
"If they continue with low interest rates, as Erdogan has signalled, the only other option is stricter capital controls," warns Selva Demiralp, professor of economics at Koc university in Istanbul.
Economics was far from the minds of Erdogan supporters, who spoke of their pride at his powerful position in the world and his hard line on fighting "terrorists", by which they meant Kurdish militants.
President Erdogan has accused his opposite number of siding with terrorists, and criticised him for promising to free a former co-leader of Turkey's second largest opposition party, the pro-Kurdish HDP.
Selahattin Demirtas has been languishing in jail since 2016, despite the European Court of Human Rights ordering his release.
Mr Erdogan said while he was in power Mr Demirtas would stay behind bars.
He also promised to prioritise rebuilding in areas hit by February's twin earthquakes and bring about the "voluntary" return of a million Syrian refugees.
Crowds flocked to Istanbul's Taksim Square, and many came from the Middle East and the Gulf.
Palestinians from Jordan wrapped Turkish flags around their shoulders and a Tunisian visitor, Alaa Nassar, said Mr Erdogan had not just made improvements to his own country, "he is also supporting Arabs and the Muslim world".
For all the celebrations, the idea of unity in this polarised country seems farther away than ever.
Since a failed coup in 2016, Mr Erdogan has abolished the post of prime minister and amassed extensive powers, which his opponent had pledged to roll back.
One voter outside an Ankara polling station on Sunday said he wanted to see an end to the brain drain that began with the post-coup purge. There is a risk that it may now intensify.
Turkey's opposition will now have to regroup ahead of local elections in 2024.
Mr Kilicdaroglu's party has two popular mayors running Ankara and Istanbul - and one of them may have had a better chance of winning the presidential race.
Additional reporting from Istanbul by Cagil Kasapoglu.