Polls have closed in the second round of El Salvador's presidential election, with both sides declaring victory in the runoff vote.
Opinion polls ahead of Sunday's vote suggested that Salvador Sanchez Ceren from the Farabundo Marti National Liberation Front (FMLN) was comfortably ahead of Norman Quijano, the candidate of the conservative Nationalist Republican Alliance (ARENA) and mayor of the capital, San Salvador.
But with 98 percent of returns tallied, Sanchez Ceren, a former far-left fighter, was leading on a razor's edge: 50.10 percent to 49.90, electoral authorities reported.
"The difference in our favour, rounding a bit, is slightly more than 8,000 votes. The Salvadoran people have made their choice ... and we have a victory to celebrate," said FMLN party chair Medardo Gonzalez.
But his ARENA counterpart was convinced its side had won.
"With the data from the electoral tribunal and our own tallies, of the utmost precision, we can say that we have achieved a victory for the Salvadoran people," ARENA chief Jorge Velado said.
Election officials told both sides to wait for final results.
"This tribunal recommends and orders that no party declare itself winner given such close results," said Supreme Electoral Tribunal president Eugenio Chicas in a TV and radio message.
Sanchez Ceren, 69, is a teacher by profession and the country's current vice president. He is also a former education minister, and was a leading FMLN commander during the country's civil war.
He fell just shy of an outright victory in the first round last month and polls now give Sanchez Ceren an advantage of between 10 and 18 points, AFP news agency reported.
"I am absolutely certain that today the people will confirm the decision they made in the first round," Mauricio Funes, the outgoing president, told reporters after casting his own vote.
Quijano, 67, is a law and order candidate who has campaigned against the country's high crime rate and the notorious "mara" street gangs at the root of much of El Salvador's drug dealing and extortion rackets.
Social programmes favoured
The conservative candidate has tried to paint Sanchez Ceren as a communist "radical" with blood on his hands but in a country where one-third of people live in poverty and many rely on money sent home from relatives living in the US, the FMLN's social programmes are popular.
Sanchez Ceren has promised to expand those programmes for the poor and fended off his opponent's claims that he will impose extreme left-wing policies.
Under the FMLN, the government says the poverty rate has fallen from 40 percent to 29 percent.
"No other government has done these things," Beatriz Herrera, a fruit seller in Santa Ana, El Salvador's second-biggest city, told Reuters news agency. "The FMLN really got to work to help those of us who are poor."
A victory for Sanchez Ceren would give the FMLN a second consecutive term.
El Salvador has remained a deeply polarised society since the war, in which the FMLN fought a series of US-backed right-wing governments. The conflict killed about 75,000 people and left many with a deep distrust of the former rebels.
The FMLN has steadily won over supporters by moderating its policies but it has still struggled to push economic reforms through a divided Congress or overcome years of sluggish growth that has fuelled the rise of violent street gangs.
Today, the wealthy live in gated communities and shop in lavish malls filled with US chain stores under the watch of armed guards. The poor, meanwhile, struggle in neighbourhoods of cinderblock homes controlled by the country's violent gangs.