The centre-left candidate won by a surprisingly wide margin over his evangelical rival, Fabricio Alvarado (no relation).
With more than 95% of votes counted, Carlos Alvarado had a 21.5 percentage point lead.
He called on other parties to join him in a government of national unity.
'Take the country forward'
Polls conducted ahead of the second round of voting on Sunday had put the two candidates neck and neck, and Carlos Alvarado's unassailable lead early on Sunday was unexpected.
In his victory speech, given on Sunday night in front of hundreds of supporters in the city of San Pedro, the ex-government minister said that Costa Ricans could now "go to sleep reassured because there is a result, a decision and now we'll unite to take this country forward".
He also said that he had already received a "brotherly call" from his rival, Fabricio Alvarado, congratulating him.
The battle between Fabricio Alvarado, an evangelical pastor who had won the first round of the election on the back of his opposition to same-sex marriage, and Carlos Alvarado, who backs its legalisation, had been fierce.
Polar opposites
The two Alvarados also disagreed on most other topics, with 38-year-old Carlos running on a progressive platform and 43-year-old Fabricio promising to defend "traditional values".
Fears about Costa Rica's national deficit and the unprecedented rise of its murder rate were among the topics voters expressed concerns about.
In the end, Carlos Alvarado's experience as a minister for labour and social security minister under President Guillermo Solís appears to have stood him in good stead with voters concerned about rising unemployment.
He also enjoyed the backing not only of heavyweights of the governing Citizens' Action Party but also of other smaller parties.
Even though Fabricio Alvarado had served one term as a lawmaker, many had questioned whether Fabricio Alvarado had the political experience and connections to govern.
Carlos Alvarado, who worked for three years for US consumer products giant Procter & Gamble, was also seen as a steady hand by Costa Rica's business sector.
His vice-president elect, Epsy Campbell, said they would go to work on Monday contacting all the different factions in the country's national assembly to forge a government of national unity.
More about: Costa-Rica