Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

SAN JOSE, Costa Rica — Center-left candidate Carlos Alvarado Quesada decisively defeated a conservative Protestant singer in Costa Rica's presidential runoff election on Sunday by promising to defend gay rights, handing a major victory to the ruling party.

Carlos Alvarado Quesada, 38, a fiction writer, had 61 percent of the vote with results in from 91 percent of polling stations. His rival, Fabricio Alvarado Munoz, 43, a former TV journalist, had 39 percent.

Alvarado Quesada, who will be the youngest president in Costa Rica's modern history, used the campaign to appeal to the progressive streak in a country known for pacifism and ecological stewardship.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Supporters of presidential candidate Carlos Alvarado Quesada of the ruling Citizen Action Party cheer after polls closed Sunday in San Jose, the capital. Arnulfo Franco / AP

The election exposed deep divisions in Costa Rica, a Central American tourist destination known for its laid-back beach culture and pristine rainforests but whose rural communities remain socially conservative.

It could also reflect the mood elsewhere in Latin America, where several countries that have backed same-sex unions are holding elections in 2018.

At a polling place in the western Pavas neighborhood of San Jose, the capital, Alvarado Quesada, until recently a minister in the outgoing government also known for his student rock band, voted and spoke briefly to supporters.

"Costa Rica is an amazing country, and we want to not only preserve its great democracy, its peaceful nature, its respect for the environment and human rights, but we also want to move Costa Rica forward," Alvarado Quesada said.

Shortly after he cast his vote at a school in the capital, Alvarado Munoz pledged to lead a government free of bias, a possible sign that he sensed that his hard-line stance was turning off centrist voters.

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.

Alvaro Quesada, by contrast, backed the court's ruling. In the campaign's final debate, he called his opponent's comments homophobic.