By Brian Ellsworth and Helen Murphy
CARACAS (Reuters) - Venezuelan President Hugo Chavez scored a comfortable election victory that could extend his rule to 20 years and vowed to deepen his self-styled socialist revolution that has polarized the South American OPEC nation.
Tens of thousands of ecstatic supporters thronged the streets around the presidential palace in downtown Caracas, pumping fists in the air and shouting Chavez's name after the former soldier beat opposition candidate Henrique Capriles by more than 9 percentage points.
The new six-year term will let Chavez consolidate his control over Venezuela's economy by extending a wave of nationalizations and continue his support for left-wing allies in Latin America and around the world.
"Truthfully, this has been the perfect battle, a democratic battle," Chavez thundered from the balcony of the presidential palace on Sunday, waving 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.
Supporters dripping with sweat strained to catch a glimpse of Chavez from the street below the palace while dancing and drinking rum.
The victory was considerably slimmer than his win by 25 percentage points in 2006, reflecting a growing frustration at his failure to fix basic problems such as crime, blackouts and corruption.
In a nod to those complaints, Chavez said he would be more efficient in his new term beginning on January 10.
"Today we start a new cycle of government, in which we are obliged to respond with greater efficacy and efficiency to the needs of our people," said Chavez. "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 principal anti-U.S. agitator, criticizing Washington while getting close to U.S. adversaries including Cuba 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 newly-built apartment complexes, helping him build a strong following among the poor.
Chavez may launch 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 cancer which has already forced him to undergo three operations in Cuba since June 2011 could derail his plans.
Opposition leaders appeared crushed by the loss.
It followed nearly a month of euphoria as Capriles, 40, polished his stump speeches, held increasingly fervent rallies and appeared be to gaining ground in the polls.
The youthful state governor put on a brave face, celebrating 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 governorship elections in December, when they will hope at least to increase the opposition's influence at the local level.
Though Capriles was indisputably the strongest candidate to face Chavez since the leftist leader's election 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 television stations to carry speeches peppered with political commentary.
He also handed out homes and pensions financed with state funds, often in ceremonies that glorified his administration, while warning that the opposition would rescind such benefits.
The spending spree has weakened the country's finances and may force a currency devaluation in early 2013, likely spurring inflation that has been a top complaint among his supporters.
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.
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 the diplomatic tension.
(To follow us on Twitter: @ReutersVzla)
(For multimedia coverage, go to http://reut.rs/QzUtvN)
(Additional reporting by Caracas bureau; Editing by Daniel Wallis and Andrew Heavens)
(c) Copyright Thomson Reuters 2012. Check for restrictions at: http://about.reuters.com/fulllegal.asp