Turkey's battle for the presidency looks almost certain to go to a run-off, with President Recep Tayyip Erdogan set for a four-point lead in the first round.
After 20 years in power, he stood on the balcony of his party HQ saying he was convinced he would win five more.
Opposition challenger Kemal Kilicdaroglu also claimed to have victory in his grasp.
Everything appeared to have fallen into place for first-round success.
But incomplete results give him around 45%, with Mr Erdogan on more than 49% of the vote. Candidates need more than 50% to win in the first round.
And Mr Erdogan has an added boost as he seeks to extend his presidency. His People's Alliance of parties has also won a majority in parliament, according to preliminary figures provided by the state news agency.
For months, Turkey's disparate opposition parties had pooled their resources in a bid to bring an end to a president who has extended his power dramatically since a failed coup against him in 2016.
And Turks went out to vote in very high numbers. Officials put the turnout at 88.8%.
The election is being watched very closely in the West, because Mr Kilicdaroglu has promised to revive Turkish democracy as well as relations with its Nato allies. On the other hand, President Erdogan's Islamist-rooted government has accused the West of plotting to bring him down and Turkey's candidacy for the EU has long been on ice.
In the early hours of Monday, Mr Kilicdaroglu stood on a stage at his party headquarters in Ankara, flanked by his allies, doing his best to sound upbeat.