A Nobel Peace Prize winner who favors a contentious free trade agreement with the U.S. was declared the country's president-elect on Tuesday — more than a month after the vote that gave him a razor-thin victory over his closest rival.

Oscar Arias, who also served as president from 1986 to 1990, defeated his nearest rival in the race by little more than 18,000 votes of the 1.6 million ballots cast, winning 664,551 votes to 646,382 for Otton Solis.

The final official vote tally was delayed both by challenges from Solis' campaign and the closeness of the race, which prompted election officials to recount all of the votes by hand before declaring a winner.

"It is evident that the party that obtained the most votes was the PLN," said Supreme Electoral Tribunal President Oscar Fonseca. "Oscar Arias Sanchez is declared constitutionally elected."

Costa Rican law does not permit immediate re-election, but the Constitutional Court ruled in 2003 that former presidents could run again after leaving office for at least one four-year term.

Arias, 65, won the Nobel Peace Prize in 1987 for his work as a mediator to help end the civil wars that wracked Central America in the 1980s.

"I would like to thank the community for giving us their confidence," Arias said. He said he believed that he fulfilled his promises to the public during his first term and "this is what has led Costa Ricans to once again give us the opportunity to serve the country 20 years later."

Flanked by vice presidents-elect Laura Chinchilla and Kevin Casas, Arias said it was "the poorest people" who helped his victory. "This government has to think principally of them," he said.

While generally very popular, Arias' support for a free-trade agreement with the United States cost him some votes to Solis, an opponent of the pact.

Arias, the National Liberation Party, argued that the agreement would help revitalize the country's stagnant economy. Solis said it would hurt farmers and should be renegotiated.

Solis, 51, conceded the election last Friday.

Twelve other candidates also sought the presidency in an election that officials said had a 64 percent turnout — the lowest in Costa Rican history.

Arias will take office on May 8, replacing current president Abel Pacheco, of the Christian Social Union party.