Support for gay marriage helped the centre-left candidate triumph over his more conservative rival
Voters in Costa Rica have elected centre-left candidate Carlos Alvarado to be their next president.
It was a close run-off in a contest divided by a court ruling ordering the Latin American country to allow same-sex marriage.
But in the end, the former minister and fiction writer won 61 percent of the vote from 95 percent of polling centres - more than opinion polls had predicted.
Alvarado achieved victory by running on a progressive platform that allows for gay marriage. His campaign slogan was: "I choose the future."
The conservative candidate, who shares the same surname, had vowed to defend what he called traditional values.
In the first round, Fabricio Alvarado had secured the most votes but missed the number needed to win outright.