Updated

Two Central American nations held presidential elections Sunday seen as referendums on political stagnation, with voters in Costa Rica deciding whether to oust a long-governing party and voters in El Salvador deciding whether to bring one back to power.

El Salvador's ruling leftist party battled to hold on to the presidency after only one term, with critics saying the government of President Mauricio Funes did little to energize a sluggish economy and reduce gang crime.

In Costa Rica, a ruling conservative party battling corruption allegations was challenged by a charismatic left-leaning congressman.

El Salvador's electoral tribunal said Sunday night that with about 39 percent of the votes counted, Vice President Salvador Sanchez had 49 percent in his bid to extend the rule of the Farabundo Marti National Liberation Front, the party of former civil war guerrillas that won the presidency for the first time in 2009.

San Salvador Mayor Norman Quijano was second with 39 percent as the candidate of the long-governing conservative Nationalist Republican Alliance, known as ARENA.

A former television journalist, Funes won the support of the poorest sectors of Salvadoran society by implementing social programs, including giving books, shoes and uniforms to school children, seeds and fertilizers to the poorest farmers and a small pension to the elderly.

"The people in rural areas, in marginalized sectors, people with lower levels of education were once the main political capital of ARENA, but they are now the FMLN's electoral stronghold," said Jeanette Aguilar, director of the Public Opinion Institute at the Central American University Jose Simeon Canas in El Salvador.

For Salvadorans, the main issues were a sluggish economy and rampant gang crime in the country of 6 million people.

Under Funes, leaders of El Salvador's main Mara street gangs declared a truce in several cities that yielded mixed results.

"Homicides have gone down but (the gangs) are still killing; now they hide the victims," said Roberto Rubio, director of the National Foundation for Development. "Extortion has intensified and gangs have solidified their control over territory."

In the last year, police have found mass graves containing the bodies of at least 24 alleged gang victims.

On top of the lack of security, Funes wasn't able to control the deficit or create jobs. But his poor handling of the economy might be not enough to bring back ARENA, said Omar Serrano at the Jose Simeon Canas university.

"The population is not satisfied with the current government, is not convinced that the FMLN should continue to rule, but it's very much convinced that ARENA shouldn't return to government," Serrano said.

A poll published Jan. 15 said Sanchez, a 69-year-old former guerrilla commander, had 37 percent support, compared to 30 percent for Quijano. Former President Tony Saca was in third with 21 percent.

Poll workers from the Public Opinion Institute at the Jose Simeon Canas university visited 1,580 likely voters at home Jan. 4-9 and asked them to fill a sample ballot. The survey had a margin of error of more than two percentage points.

Many voters remained undecided. "The FMLN seems to have better proposals, but I haven't decided on my vote," said Esteban Mejia, a 45-year-old taxi driver.

In Costa Rica, the governing National Liberation Party was beset by infighting and corruption allegations and its presidential candidate, Johnny Araya, faced three rivals, which experts said could splinter Sunday's vote.

Araya, who has been the mayor of the capital of San Jose since 2003, needed to overcome discontent over high unemployment during President Laura Chinchilla's government.

Araya's main contender was Jose Maria Villalta, a 36-year-old congressman, who ran with the Broad Front Party. Villalta made international headlines last year after a bill he proposed made same-sex unions legal in the country. The bill passed after most congress members failed to notice the final version had eliminated earlier language that defined marriage as a union between a man and a woman.