Ecuador's presidential election is set for a second round on 2 April, the electoral commission has announced.
Lenin Moreno, of the governing left-wing Pais party, fell just short of the 40% needed to win outright on Sunday.
He will fight former banker Guillermo Lasso for the top job. There had been tension after long delays in the count.
National Electoral Council President Juan Pablo Pozo blamed the delays on "numerical inconsistencies" in 5.5% of the ballots.
In past elections, official results were announced on the same night as the vote but this time counting dragged on for four days.
Final results are still not in, but with only half a percent of votes left to count, Mr Moreno, 63, cannot possibly reach the 40% needed to stave off a second round.
With 99.5% of the votes counted he had won 39.3% of the votes, against 28.1% for Mr Lasso.
The announcement that there would be a second round was celebrated by supporters of Mr Lasso, 61, gathered outside the National Electoral Council building.
Mr Lasso had earlier voiced concerns about the delay in counting saying it "did not smell right".
The conservative former banker says he is confident of winning the run-off with the backing of opposition candidates eliminated in the first round.
Third-placed Cynthia Viteri, who won more than 16% of the votes, has already called on her supporters to vote for Mr Lasso.
The election is being watched with interest in the region after other countries led by left-wing leaders, such as Argentina and Peru, have swung to the right in recent polls.
The winner will replace left-wing President Rafael Correa, who leaves office after a decade in power.
- 63-year-old left-wing former vice-president
- Close ally of outgoing President Rafael Correa
- Became paraplegic after being shot in the back in 1998
- Wants to increase employment opportunities and give all Ecuadoreans the chance to go on to higher education
- 61-year-old former banker
- Youngest of 11 children
- Wants to create a million jobs by promoting foreign investment and has promised to cut taxes for big companies
- Has vowed to evict WikiLeaks founder Julian Assange from the Ecuadorean embassy in London if he wins