Former banker Guillermo Lasso won Ecuador's presidential election on Sunday after his socialist opponent Andres Arauz conceded.
Conservative Lasso declared himself president-elect and accepted the "challenge" of changing Ecuador's "destiny."
With 98 percent of the votes counted, Lasso secured 52.49 percent of the vote while Arauz finished with 47.51 percent, according to results published by the National Electoral Council.
"On May 24 we will assume with responsibility the challenge of changing our country's destiny and achieving for all Ecuador the opportunities and prosperity we all yearn for," said Lasso.
Economist Arauz, who is best known as the protege of former president Rafael Correa, was magnanimous despite earlier claiming victory following a tight exit poll.
"I congratulate him on his electoral triumph today and I will show him our democratic convictions," said Arauz.
Lasso had 52.51 percent of the vote compared to Arauz's 47.49 percent with 93.14 percent of votes counted, the National Electoral Council said.
Seasoned politician Lasso, 65, has twice before finished second in presidential votes.
Earlier, television stations Ecuavisa and Teleamazonas published the results of the Cedatos exit poll that gave Lasso almost a 6.5 percentage point lead over Arauz.
But the stations also said the Clima Social pollsters had indicated the result was a technical draw and thus decided not to publish their figures.
Arauz's campaign team used that poll to claim victory by 1.6 percentage points.
"Thank you Ecuador! This is a victory for the Ecuadoran people," Arauz said on Twitter. "No one will prevent the course of history."
READ MORE: Lasso leads Ecuador presidential election with 90 percent votes counted
'Social division'
Voting is obligatory, and opinion polls had the rivals neck and neck heading into the election for oil-rich Ecuador's 13.1 million registered voters to pick a successor to the deeply unpopular Lenin Moreno.
The campaign in the South American country had been dominated by an economic crisis aggravated by the Covid-19 pandemic.
Arauz, 36, is virtually unknown but topped February's first round of voting on the back of support from his mentor, Correa, who led the country from 2007-2017.
He didn't vote on Sunday because he is still registered in Mexico, where he was studying for a doctorate before deciding to run in the election.
Lasso, 65, is a third-time presidential candidate having finished second to Correa in 2013 and Moreno in 2017.
Many experts billed the election as a battle of "Correism versus anti-Correism" in a country bitterly divided along political lines.
"This social division, that the campaign highlighted, means that the vote to reject Correa effectively goes to Lasso," said Pablo Romero, an analyst at Salesiana University.
Correa would have been Arauz's running mate but for an eight-year conviction for corruption.
He lives in exile in Belgium, where his wife was born, avoiding his prison sentence. But his influence on Ecuadoran politics remains strong.
Arauz, the candidate from the Union of Hope coalition, topped the first round with almost 33 percent of the vote, 13 percentage points ahead of Lasso, from the Creating Opportunities movement.
READ MORE: Ecuador's Arauz claims victory in presidential election
'Permanent tension'
Lasso will take over from beleaguered Moreno on May 24 and will immediately face an economic crisis exasperated by a 7.8 percent contraction in GDP in 2020.
Overall debt is almost $64 billion - 63 percent of GDP - of which $45 billion is external debt.
At the same time, the country has been hard-hit by the pandemic, with hospitals overwhelmed by more than 340,000 coronavirus infections and more than 17,000 deaths.
Lasso also faces a tough job during his four-year term with Arauz's leftist coalition the largest party in parliament.
"There will be permanent tension with the executive. There's almost no chance of the reforms the country needs," said Romero.
Lasso scraped into the runoff by less than half a percentage point ahead of indigenous candidate Yaku Perez, who contested the result and claimed to have been the victim of fraud.
Socialist Perez, whose Pachakutik indigenous movement is the second-largest bloc in the legislature, picked up more than 19 percent of the vote in the first round.
Pachakutik refused to back either candidate in the second round and promoted blank votes.
Perez publically annulled his own vote writing "Yaku president resistence" on his ballot.
Around 16 percent of votes were invalid, up from 9.55 percent in the first round.
READ MORE: Protests in Ecuador against job, wage cuts, over virus