A row has erupted over Ecuador's presidential elections after early results indicate a victory for the incumbent party's candidate.
With more than 98% of the votes counted, Lenin Moreno of the Socialist Party had won 51.15% and his challenger Guillermo Lasso 48.85% of the votes.
Mr Lasso has demanded a recount, arguing electoral fraud was used to grant victory to his rival.
He has also called on his supporters to take to the streets in protest.
Rollercoaster of emotions
Three exit polls had earlier predicted a win for Mr Lasso, a conservative former banker, prompting celebrations by him and his supporters.
At 17:00 local time (22:00 GMT) Mr Lasso, waving an Ecuadorean flag, took to the stage in a hotel in his hometown of Guayaquil to tell his backers that "a new Ecuador" had been born.
He tweeted a picture of the celebrations with the words: "Democracy has won, FREEDOM has won in Ecuador."
But just hours later, when Ecuador's National Electoral Council announced that preliminary results gave Mr Moreno a narrow lead over Mr Lasso, the latter cried foul.
He tweeted that "we're not stupid, nor are the Ecuadorean people" and called on them to "peacefully defend their votes".
Hundreds of Mr Lasso's supporters gathered in front of the electoral commission offices shouting "No to fraud!".
Meanwhile, supporters of Mr Moreno also took to the streets, but to celebrate.
In the capital Quito, angry protests and jubilant celebrations were going on just kilometres apart.
'We will win'
Outgoing President Rafael Correa, who backed Mr Moreno, took to the stage to sing Venceremos (We will win) before Mr Moreno delivered another victory speech.
If confirmed as the winner, Mr Moreno is expected to continue the left-wing policies of his predecessor in office.
When he was first elected in 2007, Mr Correa was one of a group of left-wing leaders in power in Latin America.
But in the decade since, conservative politicians have taken power in Argentina, Brazil and Peru. A victory for Mr Lasso would have continued that trend.
Relief for Julian Assange
Mr Moreno is also expected to allow Wikileaks founder Julian Assange to stay in the Ecuadorean embassy in London, where he took refuge more than four years ago.
Mr Lasso had threatened to evict Mr Assange within 30 days of taking office.
When preliminary results put Mr Moreno in the lead, Mr Assange tweeted that maybe now it would be time for Mr Lasso to leave the country.
Left-wing leaders including Bolivia's Evo Morales and Venezuela's embattled President Nicolas Maduro have been congratulating Mr Moreno.
However, the National Electoral Council said it would wait until all the votes had been counted to give its official result.
- 63 years old, left-wing, former vice-president
- Close ally of outgoing President Rafael Correa
- Became paraplegic after being shot in the back after being robbed in 1998
- Wants to increase employment opportunities and give all Ecuadoreans the chance to go on to higher education
- Has written books with with titles such as "Being Happy is Easy and Fun"
- 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
- Plans to make Ecuador's central bank independent of the government
- Has vowed to evict WikiLeaks founder Julian Assange from the Ecuadorean embassy in London if he wins