With 80 percent of ballot boxes counted, Humala had a narrow but growing lead of 1.4 percentage points over right-wing lawmaker Keiko Fujimori, the daughter of jailed former President Alberto Fujimori.
Exit polls and quick counts showed Humala clearly ahead and his advantage in the official returns was expected to grow as more votes came in from poor, rural areas.
|A Peruvian woman residing in Argentina votes in her country's runoff presidential election in Buenos Aires June 5, 2011|
"We want economic growth with social inclusion," Humala, 48, told thousands of cheering supporters in downtown Lima on Sunday night. "We can build a more just Peru for everybody."
His speech triggered wild celebrations by followers waving red and white Peruvian flags and rainbow-colored indigenous banners.
Some danced in jubilation, others chanted "Humala Presidente! and "Fujimori never again". Similar celebrations erupted across Peru. At one, an effigy of Fujimori burned.
Peru has been one of the world's fastest-growing economies over the last decade and is a top metals exporter, but a third of Peruvians still live in poverty.
Humala appealed mainly to the poor throughout the campaign and his plans to increase state control over the economy worry investors. Peru's stock market and sol currency stumbled as polls showed him gaining ground on Fujimori, and they were expected to fall further on Monday if he is confirmed as president-elect.
Humala narrowly lost the presidency in 2006 and has since toned down his more radical anti-capitalist policies to try to win over centrist voters.
He vows to run a balanced budget, bring experienced technocrats into his government and respect foreign investors who plan to spend $40 billion on mining and oil projects in Peru over the next decade even as he looks to help the poor.
Still, business leaders and many Peruvians fear Humala will jeopardize the country's recent economic success with interventionist policies and increased social spending.
"It's the end of the traditional right and powerful businessmen,' said Cesar Lecca, an academic who says he thinks Humala has matured.
Dominique Pedrix, who works the cash register at an upscale restaurant said he hopes labor laws will be enforced.
"My bosses will no longer be able to exploit me 12 hours a day. There will be justice for me, and those who are even poorer," he said.
Fujimori, 36, was widely seen as a safer bet on economic policy but many voted against her because of her father, Alberto Fujimori, who is serving a 25-year prison sentence for corruption and using death squads to crack down on suspected leftists when he was Peru's president in the 1990s.
Humala, who as an army commander led an unsuccessful revolt against the elder Fujimori in 2000, wasted no opportunities in this election campaign to remind voters of his rival's links to her father's decade of authoritarian rule.
WOLF IN SHEEP'S CLOTHING?
Fujimori warned Humala could wreck Peru's economic boom by dismantling the free-market reforms begun by her father. Those reforms helped set the stage for unprecedented growth over the past decade as Peru left behind the economic chaos and guerrilla wars of the 1980s and '90s.
His daughter apologized for the "excesses" of her father's rule but that apparently wasn't enough to win over the centrist voters she needed for victory.
Critics say Humala is still a hard-liner at heart who will take over private firms and try to change the constitution to allow himself to run for consecutive terms.
"At least Keiko is not a liar. Humala has four different manifestoes. He doesn't convince me and represents a return to militarism of the past," said 35-year-old security guard Julio Cauche.
Humala says he has left his radical past behind, insisting he will only serve one term and that investors have nothing to fear. He casts himself in the vein of Brazil's successful former President Luiz Inacio Lula da Silva, and has distanced himself from his one-time mentor, Venezuela's firebrand leftist leader Hugo Chavez.
Humala even hired aides who spent years with Brazil's ruling Workers' Party to help run his campaign, and they sought to portray him as a serene family man instead of an unpredictable rabble-rouser.
His military training is ingrained in his daily routine. A keen runner, he jogs around his neighborhood at the crack of dawn each morning, and keeps his hair cropped short. He is diligent, and his entourage still calls him "comandante".
Humala wants a windfall tax on Peru's vast mining sector and says the state must vigorously regulate the economy and exert more control over "strategic" natural resources, although he has ruled out taking over private firms.
Analysts said financial markets would respond negatively to a Humala victory.
"It is bearish. It is not positive news," said Alberto Bernal, head of research at BullTick Capital Markets in Miami. "There is really no reason for an investor to be hopeful."
"My sense is that the market, investors ... will be on the defensive. That kind of uncertainty is going to take a toll on the economy. I think Peru is going to lose at least a couple of quarters of investment."
Peru's government has a "contingency plan" ready to implement if markets sink following Humala's victory, Finance Minister Ismael Benavides told Reuters.
The election campaign polarized Peru with polls showing that both Humala and Fujimori are strongly disliked by up to half of all voters.
Despite his leftist roots, Humala has a constructive relationship with U.S. diplomats and meets with them regularly, but he is likely to forge closer ties with Brazil, whose companies have poured billions of dollars into Peru.
That would reinforce Brazil's ascendant influence in South America at a time of U.S. economic stagnation. Humala sees Peru as a strategic trade hub on the Pacific Ocean between two mammoth markets: China and Brazil.
Fujimori had been expected to focus on integrating the nascent Pacific Alliance -- which includes Chile, Mexico, Colombia and Peru -- in a club of Latin American free-traders that have close relations with the United States.