His rival Mujica, 74, vowed to continue the policies of Tabare Vazquez, the popular outgoing president, and work to unify Latin Americans after taking office beginning March 1.
"Comrades! This is an inside-out world! You should be up here and us down there, because the people gave us this victory!" he said in a brief, enthusiastic victory speech as rain poured over thousands of supporters in the capital, Montevideo.
He said he aims to emulate Luiz Inacio Lula da Silva, the populist Brazilian president, in implementing more moderate policies, and thanked Vazquez, each of his rivals and all his "brothers" across the continent.
Vazquez, who is constitutionally prohibited from running for office again, has a 71 per cent approval rating thanks in large part to economic policies that have allowed Uruguay to avoid a recession while keeping unemployment low and even reducing poverty levels from 26 per cent in 2007 to 20.5 per cent in 2008.
|Mujica, also known as "Pepe", vowed to stick to more moderate policies [AFP]
Hoping to send a sign of economic continuity, Mujica chose Danilo Astori, Vazquez's former economy minister, as his running mate and said he would be responsible for economic policy.
Known popularly as "Pepe", Mujica was a leader of the Marxist Tupamaros guerrilla movement that carried out robberies, political kidnappings and bombings against the government.
He was held in prison for 14 years before his release in 1985, when democracy was restored to Uruguay after its 1973-1985 dictatorship.
Critics however are troubled by his undiplomatic outbursts, including putdowns of the government in neighbouring Argentina.
Mujica himself acknowledged his sharp tongue in his speech, saying: "If at some point my temperament, which is combative, has let my tongue get away from me, I ask for forgiveness."
But some of his supporters said they were drawn to his straight-talking style.
"I like the fact he speaks his mind even though I don't always agree with him," Maria Noel Gonzalez, a 24-year-old cook, said.
Thousands of Mujica supporters filled the streets of downtown Montevideo, honking car horns and waving flags to celebrate after his rival conceded.