A center-left academic who has never held elected office easily won Costa Rica's presidential election on Sunday, ousting the graft-stained ruling party from power after its candidate quit campaigning a month ago. However he will have quite a job ensuring support in Congress.
Former diplomat Luis Guillermo Solis, of the Citizen Action Party (PAC), won more than three-quarters of votes by tapping in to public anger at rising inequality and government corruption scandals.
He had defied pollsters' predictions by coming in ahead of his rivals in a first round of voting in February, and then took a huge lead in opinion polls ahead of the run-off.
In a bizarre twist, his rival Johnny Araya of the ruling National Liberation Party (PLN) announced last month he was halting his campaign as polls showed him with little or no chance of catching Solis.
Araya remained on the ballot as required by the constitution and his party continued to campaign, but he faced a heavy defeat.
Solis had 77.88% of the vote with returns in from 94% of polling booths, Costa Rica's election tribunal said. Araya had just 22.12% of the vote, and quickly conceded defeat.
Solis ran on a promise to fight Costa Rica's stubborn poverty rate and to stamp out corruption, an issue that has dogged incumbent President Laura Chinchilla's administration and which struck a chord with voters.
Jubilant Solis supporters waved red-and-yellow PAC flags in the streets of San Jose, and drivers honked their horns in celebration.
Solis' victory hands the young PAC its first presidential victory, and wrests power from the PLN, which has been in power since 2006.
Solis was a member of the PLN for 30 years, but abandoned the party in 2005, denouncing internal voting irregularities.
A prosecutor's investigation into allegations of abuse of authority and embezzlement while Araya was mayor of San Jose made it hard for the former front-runner to distance himself from party scandals.
Solis has promised to boost social spending, although he says he will wait two years before raising taxes. His more egalitarian message chimed with voters, who have seen inequality rise steadily in recent years.
But Solis faces numerous hurdles, however. His PAC will have just 13 of the 57 seats in Congress and he may struggle to find the money to finance social programs.
He's going to have a government without money, a fiscal deficit of 6 percent, and lots of social spending commitments, said Jose Carlos Chinchilla, a political analyst and a director at the University of Costa Rica.