MEXICO CITY — A debate over same-sex marriage propelled an evangelical Christian singer from a long-shot candidate to the top vote-getter in the first round of Costa Rica’s presidential election Sunday.

Fabricio Alvarado, a former television journalist who became an influential Pentecostal singer, will face Carlos Alvarado Quesada, a former labor minister, in the April 1 runoff. The two men are not related.

Mr. Alvarado had won almost 25 percent of the vote to nearly 22 percent for Mr. Alvarado Quesada, with about 90 percent of the polling places counted, the nation’s electoral board said.

What had been a conventional campaign in Latin America’s most enduring democracy — with debates over corruption, crime and the economy — was suddenly upended four weeks ago when an international court decision required Costa Rica to legalize same-sex marriage.