"I want to make it known to Mauricio Funes from the FMLN that in this close battle the margin of difference has given him the advantage," Avila said, recognising the end of two decades of rule by his party.

'Peaceful and massive'

At least 20,000 government troops were deployed to maintain order during the elections but voting was "peaceful and massive", Walter Araujo, the president of the supreme electoral tribunal, said.

In depth


 Analysis: El Salvador's left senses victory


 Video: Leftists eye El Salvador presidency

The FMLN win is the first defeat for conservatives since the country's 12-year civil war, in which 75,000 people were killed.

The election campaign had polarised El Salvador.

Funes pledged to combat corruption and tax evasion and ease the burden of the global downturn with centre-left policies aimed at helping the poor.

He had also promised to crack down on big business which he said exploited government complacency to evade taxes.

Avila, a former army sniper, with close ties to the business community, said he was the better qualified candidate to handle problems linked to the global recession and argued that Funes would turn the country into a Venezuelan socialist satellite.

Al Jazeera's Mariana Sanchez, reporting from San Salvador, said that Funes was a fresh face for the FMLN, having never fought with the guerrillas during the civil war, and commanded a lot of respect within the country.

During the civil war, Funes had worked for the CNN Spanish television channel and a commercial station in the capital, San Salvador, reporting on the war, which ended in 1992, before becoming a host of one of the country's most popular television shows.

US relations

Alberto Arene, a political analyst, told Al Jazeera that Funes faced many challenges.

Funes said it was the happiest
night of his life [Reuters]
"We have a global economic crisis, deepening poverty levels, and many other issues," he said.

"I think he will have to govern from the centre if he wants to make a more viable government."

El Salvador, the most densely populated country in the Americas, is still recovering from the civil war, in which more than 75,000 people were killed, with many still missing, following 12 years of fighting between the army-backed government and FMLN fighters.

The country has been a close US ally and Arena supporters said an FMLN victory could affect the country's relationship with Washington.

But Funes has pledged to develop relations with the US.

A quarter of the country's population lives in the US and the tiny nation - Central America's smallest - relies heavily on remittances.

The government estimated that 40,000 immigrants in the US returned to vote.