Exit polls and early counting put 41-year-old Volodymyr Zelenskiy, who plays a fictional president in a popular TV series, comfortably ahead of incumbent President Petro Poroshenko in the first round, though short of a majority.
Zelenskiy's rise coincided with voters around the world upending the status quo, propelling anti-establishment forces such as US President Donald Trump and Italy's 5-Star movement to power.
He must convince voters he is fit to lead a country at war and at the centre of the West's tussle with Moscow after the 2014 Maidan street protests ejected Poroshenko's Kremlin-friendly predecessor and Russia annexed Crimea.
Investors are also watching to see if the next president will push reforms required to keep the country in an International Monetary Fund bailout programme that has supported Ukraine through war, sharp recession and a currency plunge.
Though criticised for being an unknown quantity and light on policy detail, Zelenskiy's emergence is a powerful challenge to the veteran politician Poroshenko and former Prime Minister Yulia Tymoshenko, who trailed in third place.
No candidate is expected to receive more than half the votes, meaning the election would go to a runoff on April 21. Out of a crowded field of 39 candidates, none of the likely winners wants to move Ukraine back into Russia's orbit.
"I would like to say 'thank you' to all the Ukrainians who did not vote just for fun," Zelenskiy told cheering supporters on Sunday evening. "It is only the beginning, we will not relax."
In keeping with the relaxed style of his campaign, Zelenskiy's election night venue provided a bar with free alcohol, table football and table tennis games.
Poroshenko called the result a "severe lesson", especially from younger voters and appealed for their support in the second round.
"You see changes in the country, but want them to be quicker, deeper and of higher quality. I have understood the motives behind your protest," he said.
Poroshenko sought to portray Zelenskiy as unfit to represent Ukraine abroad, especially in taking on Russian President Vladimir Putin in international talks.
Putin "dreams of a soft, pliant, tender, giggling, inexperienced, weak, ideologically amorphous and politically undecided president of Ukraine. Are we really going to give him that opportunity?" Poroshenko said.
Zelenskiy secured 30.6 percent of votes, compared with Poroshenko's 17.8 percent, according to an updated exit poll released at 11pm, three hours after voting closed.
Tymoshenko, who won 14.2 percent of the votes, challenged the accuracy of the exit poll, saying her internal polling put her in second place behind Zelenskiy. She said at a news conference that she might contest the final result.
Preliminary results, with 9 percent of data from polling stations processed, had the top three in the same order.
Stuart Culverhouse, head of sovereign and fixed-income research at investment bank Exotix, said Zelenskiy had tried to present himself more professionally by meeting business leaders and talking of orthodox economic policies.
"That said, if the exit polls are confirmed in the official vote count, we would expect Zelenskiy to be put under greater pressure in the run-up to the second round to flesh out his policy agenda," he said.
Poroshenko has fought to integrate the country with the European Union and NATO, while strengthening the military that is fighting Kremlin-backed separatists in the east of the country.
Voting around the nation offered a snapshot of Ukraine's recent history. Soldiers lined up to vote in makeshift polling stations in the east.
Voters formed long lines outside polling stations in neighbouring EU member Poland, where between one and two million Ukrainians have moved, many in search of jobs and higher wages.
Pushing the use of the Ukrainian language and instrumental in establishing a new independent Orthodox church, confectionary magnate Poroshenko, 53, has cast himself as the man to prevent Ukraine again becoming a Russian vassal state.
But reforms crucial to keep foreign aid flowing have been patchy. Conflict in the eastern Donbass region has killed 13,000 people in five years and rumbles on despite Poroshenko's promise to end it within weeks.
Frustration over low living standards in one of Europe's poorest countries and pervasive corruption has left the door open for Zelenskiy.
The majority of voters in separatist-held eastern Ukraine and Crimea were unlikely to take part in the election as they need to undergo a special registration process on Ukraine-controlled territory.
But Crimean residents who kept their Ukrainian citizenship after the Russian annexation five years ago crossed the land border to mainland Ukraine, from where buses took them to the nearest polling stations.
Just 9 percent of Ukrainians have confidence in their national government, the lowest of any electorate in the world, a Gallup poll published in March showed.
Zelenskiy has tapped into this anti-establishment mood, although his inexperience makes Western officials and foreign investors wary.
His campaign has relied heavily on social media and comedy gigs of jokes, sketches and song-and-dance routines that poke fun at his political rivals.
"This is a battle to change the country, to change the political system. It has completely discredited itself and is not supported by Ukraine's citizens or by its Western partners," Zelenskiy's political consultant, Dmitry Razumkov, told Reuters. "After five years of fighting corruption, we have returned to where we started."
Zelenskiy's campaign blurred the line between reality and the TV series in which he plays a scrupulously honest history teacher who accidentally becomes president.
In series three, which began airing in March, his character is flung into prison and the country falls under the control of oligarchs, populists and ultranationalists, and eventually gets broken up into 28 states. Thinly disguised characters resembling Poroshenko and Tymoshenko come to power.
"He embodies the perceived need for 'new faces' in politics and could sway the young, pro-reform electorate to his side," said Economist Intelligence Unit analyst Agnese Ortolani.