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 Mr. 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 Mr. 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.
"Truthfully, this has been the perfect battle, a democratic battle," Mr. Chavez thundered from the balcony of the palace 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 Mr. Capriles.
More than 80 percent of registered voters cast ballots.
Supporters dripping with sweat strained to catch a glimpse of Mr. Chavez from the street below the palace while dancing and drinking rum. "Chavez, the people are with you!" they chanted.
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, Mr. 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, Mr. Chavez has become Latin America's main anti-U.S. 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 newly-built apartment complexes, helping him build a strong following among the poor.
Following his victory On Sunday, Mr. 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.
Cancer still a wild card
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.
During a year's treatment from mid-2011, Mr. Chavez endured three operations for two cancerous tumours, and chemotherapy that left him bald, exhausted and fearing death at his lowest point.
He wrongly declared himself cured once, and repeated that in July after a recurrence, prompting skepticism from doctors who say that at least two years must pass before a cancer patient can be given a clean bill of health.
Mr. Chavez has looked bloated and at times exhausted in recent months, but he ran a surprisingly energetic end to his campaign, even managing to dance, sing and strum a guitar at rallies.
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.
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 Mr. 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.
Though Mr. Capriles was indisputably the strongest candidate to face Mr. Chavez since the leftist leader's was elected in 1998, few in the opposition thought the fight was fair.
Mr. 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 homes 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.
Mr. Chavez's win will probably mean more foreign investment from politically allied countries such as China, Russia, Iran and Belarus, while Western investors remain more cautious. 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.
Wall Street had been hoping for a Mr. Capriles win, so prices of Venezuelan bonds - among the most actively-traded emerging market debt - are likely to dip on Mr. Chavez's triumph.
State elections ahead
Now, Mr. Capriles and other leaders of the Democratic Unity coalition must dust themselves off and prepare for state governorship elections in December, when they will hope at least to increase the opposition's influence at the local level.
Mr. Chavez's llatest election win continues a remarkable story that began with his birth on July 28, 1954, in a mud hut belonging to his grandmother in the rural village of Sabaneta.
He joined the army and spent years plotting before a failed coup in 1992 against then-President Carlos Andres Perez.
On his way into jail, wearing a red military beret that was to become his trademark, Mr. Chavez gave a two-minute televised speech admitting that his revolution had failed "for now." The speech electrified the nation and launched his political career.
Pardoned in 1994, Mr. Chavez began crisscrossing the country sharing his vision and eventually shocking the political elite by sweeping to victory at the ballot box in 1998.
With private media and business leaders opposed to his rule, Mr. Chavez was briefly toppled by army dissidents and street protests in 2002 - but returned two days later thanks to military loyalists and popular counter-demonstrations.