Socialist Lenin Moreno won Ecuador's presidential election, the electoral authority confirmed, bucking a trend in Latin America to extend a decade of leftist rule in the major oil exporter.
National Electoral Council chief Pablo Pozo said on television that "irreversible official results" showed Moreno, 64, won with 51.16 percent of the votes.
With 99.65 percent of the ballots counted, he was more than 229,000 votes ahead of his conservative rival Guillermo Lasso, 61, who has alleged voting fraud and refused to accept the result.
Lasso had 48.84 percent.
"We congratulate the Ecuadoran people, who have legally and legitimately elected their president," Pozo said.
"Ecuador has spoken freely at the ballot box and it is our ethical duty to respect its vote and its voice."
- Recount demanded -
Moreno had on Monday declared himself the "president of all Ecuadorans" as the last results were counted from Sunday's runoff election.
Lasso has vowed to challenge the result and demanded a recount.
Pozo said the electoral council "totally guarantees the right of both political sides to present objections, challenges and appeals through legal institutional channels" by an April 12 deadline before the result is officially promulgated.
The Organization of American States said its election observers "witnessed that there were no discrepancies between the ballot papers they observed and the official figures" reported by the council.
- Warning to Assange -
The race between Moreno and conservative ex-banker Lasso was closely watched as a political barometer in Latin America, where more than a decade of leftist dominance has been waning.
Argentina, Brazil and Peru have all shifted to the right in recent months as the region has sunk into recession.
But Moreno, a wheelchair user and champion of disability rights, is seen as a more moderate successor to outgoing leftist President Rafael Correa.
Whereas Correa declared "21st-century socialism" in Ecuador and regularly berated the United States, Moreno is known for cracking jokes and reaching out to opponents.
"I'm going to be the president of all Ecuadorans. Yes, all, but especially the poor," Moreno said in a speech outside the presidential palace Monday.
He will be the first wheelchair user to be elected Ecuador's president, and one of few such leaders in world history. His legs have been paralyzed since he was shot in a carjacking in 1998.
His win is a relief for WikiLeaks founder Julian Assange, who faced a threat by Lasso to expel him from his refuge in Ecuador's London embassy.
But Moreno warned Assange to stay out of Ecuadoran politics, after the Australian taunted Lasso on Twitter following his loss.
"Mr Julian Assange must respect the condition (of asylum) he is in and not meddle in Ecuadoran politics," he said.
- Protesters cry fraud -
Lasso vowed to challenge the result, alleging "blatant fraud."
"I cannot accept these results because they do not reflect the will of the people," he told a press conference Monday.
Some Lasso supporters protested outside election offices in Quito and other cities.
Moreno's victory will likely hold, wrote Risa Grais-Targow of the Eurasia Group consultancy, in a note.
"The government enjoys a significant institutional advantage, with the National Electoral Council, the courts, and the legislature all firmly under its control," she said.
- Changing political map -
Lasso had vowed to undo Correa's legacy, after the country's economic boom went bust.
Boosted by high prices for its oil exports, Ecuador registered solid economic growth during the first eight years of Correa's presidency, before tipping into recession in 2015.
Correa won loyal fans among the poor with generous social benefits that helped slash the poverty rate in this country of 16 million people.
But he has also faced accusations of corruption and squandering the windfall of the oil boom.
"Moreno will face two challenges: starting his term in government with diminished popularity (for his side) and with an economy that is going through lean times," political scientist Esteban Nicholls from the Andean University of Ecuador told AFP.