Costa Rica’s governing party has secured a big presidential election victory as many voters rejected an evangelical pastor who had jumped into political prominence by campaigning against same-sex marriage.

The head of the supreme electoral council Luis Antonio Sobrado said that with 95 per cent of ballots counted, Carlos Alvarado of the ruling Citizens’ Action Party had 60.8 per cent of the votes in the runoff election. His opponent, Fabricio Alvarado of the National Restoration party, had 39.2 percent. The two men are not related.

​Fabricio Alvarado rose from being a political unknown to the leading candidate in the election’s first round in February after he came out strongly against a call by the Inter-American Court of Human Rights for Costa Rica to allow same-sex marriage.

Carlos Alvarado, a novelist and former labour minister who finished second to get the final spot in the runoff, spoke in favour of letting gay people wed.

The victor tweeted: “Let’s celebrate our 200 years of Independence with a government worthy and up to date with the times. Today, the world is watching us and we sent a beautiful democratic message.”

Recent opinion polls had said the candidates were running head-to-head going into the runoff, but in the end Mr Alvarado had an easy win.

In a speech to supporters, Fabricio Alvarado conceded defeat but said he had managed to raise the banner of “principles and values”.

He said: “We are not sad, because we made history, because our message touched the country’s deepest nerves.”

The two share similarities beyond their family name. Both have backgrounds in journalism and both have recorded music – Fabricio Alvarado as a gospel singer and Carlos Alvardo as a college-age rock’n’roller.

Both candidates also had economic advisers who take a conservative approach to economics, favouring the free market and calling for a reduction in the size of government.

Voter Maria Rodriguez said she supported Carlos Alvarado because she rejected his rival’s homophobic discourse and does not believe the evangelical candidate was qualified to be president.

Rodrigo Lopez said Fabricio Alvarado was his choice because Costa Rica should maintain its traditional values and he is tired of the ruling party’s corruption.