Turkish President Tayyip Erdogan said current results showed him far ahead of candidate Kemal Kilicdaroglu in Sunday's presidential elections, but stopped short of declaring outright victory.
In his first appearance after the polls closed, Erdogan said votes from abroad were still being counted and that he was 2.6 million votes ahead of his rival.
In a fiery speech to an exuberant crowd outside his AK Party's headquarters in Ankara, Erdogan said that he would respect the people's decision if the presidential vote goes to a runoff.
The secular opposition camp spearheaded by Kilicdaroglu cried foul. "We are leading," the 74-year-old tweeted.
Leading opposition figures said the government was purposely slowing down the count in districts where Kilicdaroglu was enjoying strong support.
"They are contesting the count emerging from ballot boxes where we are massively ahead," Istanbul's opposition mayor Ekrem Imamoglu told reporters.
Imamoglu said the opposition's internal vote count showed Kilicdaroglu picking up 49 percent of the vote and Erdogan just 45.
But neither the state media count nor the one presented by the opposition avoids the possibility of Turkey holding another presidential vote in two weeks.
The election night drama reflected the massive stakes involved.
Turnout was expected to reach 90 percent in what has effectively become a referendum on Turkey's longest-serving leader and his Islamic-rooted party.
Erdogan has steered the nation of 85 million through one of its most transformative and divisive eras.
Turkey has grown into a military and geopolitical heavyweight that plays roles in conflicts from Syria to Ukraine.
The NATO member's footprint in both Europe and the Middle East makes the election's outcome as critical for Washington and Brussels as it is for Damascus and Moscow.
Erdogan is lionised across swathes of conservative Turkey that witnessed a development boom during his rule.
More religious voters are also grateful for his decision to lift secular-era restrictions on headscarves and introduce more Islamic schools.
"My hope to God is that after the counting concludes this evening, the outcome is good for the future of our country, for Turkish democracy," Erdogan said after casting his ballot in Istanbul.
Erdogan's first decade of economic revival and warming relations with Europe was followed by a second one filled with social and political turmoil.
He responded to a failed 2016 coup attempt with sweeping purges that sent chills through Turkish society and made him an increasingly uncomfortable partner for the West.
The emergence of Kilicdaroglu and his six-party opposition alliance -- the type of broad-based coalition Erdogan excelled at forging throughout his career -- gives foreign allies and Turkish voters a clear alternative.
A runoff on May 28 could give Erdogan time to regroup and reframe the debate.
But he would still be hounded by Turkey's most dire economic crisis of his time in power, and disquiet over his government's stuttering response to the February earthquake that claimed more than 50,000 lives.
"We all missed democracy," Kilicdaroglu said after voting in the capital Ankara. "You will see, God willing, spring will come to this country."
Pre-election polls indicated Kilicdaroglu would win the youth vote -- nearly 10 percent of the electorate -- by a two-to-one margin.
"I can't see my future," university student Kivanc Dal, 18, told AFP in Istanbul on the eve of the vote.
Erdogan "can build as many tanks and weapons as he wants, but I have no respect for that as long as there is no penny in my pocket".
But nursery schoolteacher Deniz Aydemir said Erdogan would get her vote because of the economic and social progress Turkey made after half a century of corruption-riddled secular rule.
The 46-year-old also questioned how a country could be ruled by a coalition of six parties -- a favourite attack line of Erdogan during the campaign.
"Yes, there are high prices... but at least there is prosperity," she said. Erdogan's campaign became increasingly tailored to his core supporters as election day neared.
He branded the opposition a "pro-LGBT" lobby that took orders from outlawed Kurdish militants and was bankrolled by the West.
Erdogan's ministers and pro-government media referred darkly to a Western "political coup" plot. The opposition began to worry that Erdogan was plotting how to hold on to power at any cost.
Erdogan bristled when asked on Friday night television if he would agree to leave if he lost. "This is a very silly question," he fumed. "We would do what democracy requires."
(With inputs from agencies)