The centre-left's Carlos Alvarado Quesada decisively defeated a conservative Protestant singer in Costa Rica's presidential runoff election on Sunday by promising to allow gay marriage, protecting the country's reputation for tolerance.
A former minister and fiction writer, Quesada, 38, had 61 per cent of the vote with results in from 95 per cent of polling stations, a far bigger lead than predicted by opinion polls that foresaw a tight race.
'My commitment is to a government for everybody, in equality and liberty for a more prosperous future,' he told thousands of cheering supporters blowing horns and waving Costa Rica's red, white and blue flag.
'There is much more that unites us than divides us.'
His rival, Alvarado Munoz, a 43-year-old former TV journalist known for religious dance songs, quickly conceded, sinking to his knees, arms raised, in front of supporters, some of them crying.
'We didn't win the election,' he said, adding that he had congratulated his opponent in a telephone call and, in another sign of Costa Rica's cordial politics, promised to help him resolve the country's problems.
The election had exposed divisions in the Central American tourist destination known for laid-back beach culture and pristine rainforests, but where some rural communities remain socially conservative.
It could also reflect the mood elsewhere in Latin America, where elections are being held this year in several countries that have backed same sex unions, provoking a conservative reaction.
Alvarado Quesada, until recently a minister in the outgoing government, will be the youngest president in the modern history of Costa Rica when he takes office in May.
Also known for his student prog-rock band, he used the campaign to appeal to his country's centrist streak. His vice presidential candidate, Epsy Campbell, will be the country's first Afro-Costa Rican to serve in that role.
Opponent Alvarado Munoz had vowed to restore what he called traditional values by preventing gay marriage and restricting women's access to abortions.
The two men took opposing positions on a January decision by the Inter-American Court of Human Rights, an influential regional body based in San Jose.
Fabricio, as supporters refer to Alvarado Munoz, called the ruling an affront to sovereignty. Threatening to remove the country from the court's jurisdiction, he shot from the margins to win the first round of voting in February.
Quesada, by contrast, backed the court's ruling. In the campaign's final debate, he called his opponent's comments homophobic.