But the result of the national referendum itself was under challenge as the main opposition party charged that a last-minute change in the counting rules opened the way to massive fraud.
The package of 18 constitutional amendments will eliminate the post of prime minister and give the president the power to name his government, without requiring approval from the parliament. It will also expand his control over the judiciary, which is already largely subservient to Erdogan.
The changes, which would take effect in 2019, also would allow Erdogan to run for two additional five-year terms, and possibly a third. Opponents say the referendum could be the end of democracy in Turkey.
The vote was close. With all ballots counted, Erdogan had racked up 24.9 million "yes" votes to 23.6 million "no" votes, a margin of 51.3% to 48.6%, according to the state Anadolu news agency.
The southeast of Turkey voted decisively against the changes, as did Aegean coastal districts. Also voting "no," although by slimmer margins, were Istanbul, Ankara and other major cities.
But Erdogan's Justice and Democracy Party swept nearly all of the Anatolian heartland, as it had in the last national parliamentary elections in November 2016.
According to the opposition Republican People's Party, or CHP, 2.5 million votes were suspect because they lacked the stamp of the Supreme Election Board, which oversees the elections, or were subject to other irregularities.
The board, whose membership is dominated by members of Erdogan's party, announced halfway through the voting that it had received complaints that envelopes containing the ballot papers were missing that stamp. But it ruled that the ballots would be declared invalid only if it could be proven that they were cast fraudulently.
"The Supreme Election Board has changed the rules of the vote," said Bulent Tezcan, a CHP deputy chairman. "This amounts to … allowing fraud in this vote."
Erdal Aksunger, another deputy CHP leader, said 2.5 million votes are in dispute, and in some areas, such as the predominantly Kurdish southeast, almost half the votes could be challenged.
He estimated that 1.5 million unstamped envelopes and voting papers were given to voters, and there were also many incidents in which envelopes and voting papers were stamped after the ballots were opened.
"There are 2.5 million suspicious votes. Altogether, it seems this was a well-organized operation," he told The Times.
Kemal Kilicdaroglu, the CHP chairman, promised to challenge the board's "contradictory" decision in the courts. "Election law stipulates that envelopes will be invalid without stamps," he told supporters at the party's Ankara headquarters.
Erdogan declared victory before the election board had announced the result. Speaking of a "historic decision," he said critics shouldn't try to belittle the results. "It will be in vain," he said.
And in remarks portending tense times ahead in Turkey's relations with Europe, he responded to chants from the crowd calling for a reinstatement of the death penalty, which Turkey dropped in 2004 as part of its bid to join the EU. Erdogan said he was ready for that issue and might even put it to a referendum.
If he proceeds, Turkey's EU bid is effectively over. The EU insists that its members abolish the death penalty.
Prime Minister Binali Yildirim, sounding a more conciliatory note, declared there were no losers in the referendum but that the Turkish nation had won.
"We are brothers, we are one body, we are one nation," he said, appearing at the balcony of his official residence.
Kilicdaroglu charged that the referendum had been staged under "unequal conditions" and the outcome would do nothing to reconcile the country's divisions.
"This referendum showed that at least 50% of the society says 'no' to that constitution," he said.
The opposition leader himself is under fire for tepid leadership in comparison with the charismatic Erdogan, and when he arrived at CHP headquarters, a group awaiting him chanted that he should resign. But another faction quickly assembled and chanted: "Kilicdaroglu, the hope of the people."
A colleague said that Kilicdaroglu deliberately kept his remarks low-key, fearing that if supporters' emotions ran free, it could lead to clashes with Erdogan backers, causing deaths and even civil war.
Erdogan, who took the leading role in the campaign for a "yes" vote, claimed a "presidential system" will be more efficient in addressing Turkey's myriad security challenges. These include a Kurdish insurgency in the southeast, threats from Islamic State extremists based in neighboring Syria and the aftermath of a failed coup last July, which he has blamed on a Muslim preacher living in U.S. exile.
His opponents say the changes will lead to one-man rule and possibly a dictatorship.
Gutman is a special correspondent.
5:10 p.m.: This article has been updated throughout with quotes, analysis, background and latest vote totals.
11:35 a.m.: This article has been updated with Erdogan declaring victory.