Venezuelan President Hugo Chavez promised to deepen his socialist revolution after a comfortable election victory that could extend to 20 years his polarizing leadership of the South American OPEC nation.
Tens of thousands of ecstatic supporters thronged the streets around the presidential palace overnight, pumping fists in the air after the former soldier beat opposition candidate Henrique Capriles by 9 percentage points.
The new six-year term will let Chavez consolidate his control over Venezuela's economy, possibly by extending a wave of nationalizations, and continue his support for left-wing allies in Latin America and around the world.
"This has been the perfect battle, a democratic battle," Chavez thundered from the palace balcony late on Sunday, holding up a replica of the sword of independence hero Simon Bolivar.
"Venezuela will continue along the path of democratic and Bolivarian socialism of the 21st century."
It was an extraordinary victory for a leader who just a few months ago feared for his life as he struggled to recover from cancer. He won 54.4 percent of the vote, with 90 percent of the ballots counted, compared with 45 percent for Capriles.
Turnout was a record 80 percent of registered voters, boosting Chavez's democratic credentials despite critics' depiction of him as a dictator.
Supporters dripping with sweat strained to catch a glimpse of Chavez from the street below the palace while dancing and drinking rum. "Chavez, the people are with you!" they chanted.
"He will keep protecting the poor, the defenseless and the old," said teacher Gladys Montijo, 54, weeping with joy.
The victory was considerably slimmer than his win by 25 percentage points in 2006, reflecting growing frustration at his failure to fix problems such as crime, blackouts and corruption.
In a nod to those complaints, Chavez said he would be more focused in his new term beginning on Jan. 10.
"Today we start a new cycle of government, in which we must respond with greater efficacy and efficiency to the needs of our people," he said. "I promise you I'll be a better president."
A retired lieutenant colonel who first won fame with a failed 1992 coup, Chavez has become Latin America's main anti-US agitator, criticizing Washington while getting close to its adversaries, including Cuba, Syria and Iran.
A decade-long oil boom has given him tens of billions of dollars for social investments that range from free health clinics to new apartment complexes, helping him build a strong following among the poor.
Following his victory on Sunday, Chavez could order new nationalizations in some largely untouched corners of the economy, including the banking, food and health industries. He took advantage of his landslide win in 2006 to order takeovers in the telecoms, electricity and oil sectors.
But any recurrence of the pelvic cancer which has already forced him to undergo three operations in Havana since June 2011 could derail his plans.
Opposition leaders were crushed by the loss. It followed nearly a month of euphoria among Capriles supporters as the 40-year-old polished his stump speeches, held increasingly fervent rallies and appeared be to gaining ground in the polls.
"We are all hurt and sad but not disappointed. It was an incredible campaign," said housewife Teresa Perez, 51.
"Now I don't know what's going to happen with Chavez in power for six more years."
The youthful state governor put on a brave face, hailing his "house-by-house" campaign as the start of a long road to changing the direction of the country.
"I gave it my all and I'm proud of what we built," a subdued Capriles told supporters at his campaign headquarters.
"I will continue to work for Venezuela."
He and other leaders of the Democratic Unity coalition must now prepare for state governor elections in December, when they will hope at least to increase the opposition's influence. They were hugely disappointed at only winning a majority vote in three of Venezuela's 24 states on Sunday.
The US State Department congratulated the Venezuelan people for the high turnout and generally peaceful voting.
"We believe that the views of the more than 6 million people who voted for the opposition should be taken into account going forward," said State Department spokesman William Ostick.
Though Capriles was indisputably the strongest candidate to face Chavez since the leftist leader was elected in 1998, few in the opposition thought the fight was fair.
Chavez made ample use of state television and spent 47 hours in "chain" broadcasts that force other local television stations to carry speeches peppered with political commentary.
He also handed out houses and pensions financed with state funds, often in ceremonies that glorified his administration, while warning that the opposition would cancel such programs.
The spending spree has weakened Venezuela's finances and may force a currency devaluation in early 2013, which would likely spur inflation that has been a top complaint among voters.
The election result is likely to prompt a sell-off in Venezuelan bonds, which have jumped in recent weeks on Wall Street optimism about a possible Capriles win.
"Going forward, we believe the market is likely to, as in recent years, continue to look at Venezuela as a gradually deteriorating macro story and trade it increasingly as an oil play," Goldman Sachs said in a research note.
Relations with Washington are also likely to remain on edge, though Venezuelan oil has continued to flow to the United States over the years despite diplomatic tensions.