Venezuelan President Hugo Chavez shrugged off cancer and a unified opposition to triumph yet again at the ballot box and claim another six-year mandate to pursue his oil-funded socialist revolution.

Sunday proved a sterner test than previous elections in Chavez's 14-year tenure, but the bombastic anti-American leftist emerged victorious again despite health scares, growing discontent and a strong opposition challenge.

With nearly all the votes counted, Chavez had 7,731,972, or 54.66 percent, compared to 6,327,429, or 44.73 percent, for his youthful opponent, former Miranda state governor Henrique Capriles.

Thousands of people massed in front of the Miraflores presidential palace following the results of Sunday's election which gave Chavez a clear victory after almost 14 years in power.

"The revolution is unstoppable," said Maria Bermudez, a teacher from the northern state of Guarico wearing a red shirt, the trademark colors of Chavez supporters. "Chavez never lost my vote to continue the revolution."

In an address from the balcony of his residence, Chavez sang the national anthem and vowed to be a better president.

"Viva Venezuela! Viva the fatherland!" exulted the leftist leader. "The battle was perfect and the victory was perfect."

"I want to include everybody, including sectors of the opposition," the 58-year-old Chavez, wearing his trademark red shirt, said in a tacit acceptance of the best electoral showing against him yet.

But, brandishing the sword of his 19th century idol, independence hero Simon Bolivar, he pledged to press ahead with a socialist revolution that has antagonized opponents, both at home and abroad.

"Venezuela will continue its march toward the democratic socialism of the 21st century," he said.

Chavez declared himself free of cancer in July and intensified his campaign this past week, holding rallies across the country, even dancing and singing in the rain before hundreds of thousands of supporters on Thursday.

In his victory speech, he alluded only briefly to his cancer battle.

"Today was a memorable day," he said. "I thank God and ask him life and health to keep serving the Venezuelan people."

Chavez's rival, 40-year-old Capriles, was gracious in defeat, saying: "I accept and respect the decision of the people."

But it was a bitter pill for many in the divided country to swallow. Some 200 Capriles supporters, many in tears and disbelief, massed outside his campaign headquarters.

"I am disappointed, devastated," Daniela Torrealba, 33, told AFP. Chavez's victory means six more years of "uncertainty and stagnation," he said.

Election experts said the electronic voting system was reliable, but suspicions ran high that whoever lost would not concede defeat.

Capriles appeared to put those fears to rest, accepting the result in good faith after an earlier call for calm.

"To know how to win, you have to know how to lose," he said at his campaign headquarters. "For me, what the people say is sacred."

The fate of Chavez, a fierce US critic and the leading voice of Latin America's left, was closely watched by communist ally Cuba, which heavily depends on Venezuela's oil, and other regional partners.

"Viva Venezuela, viva the great fatherland, viva the Bolivarian Revolution!" leftist Ecuadoran President Rafael Correa tweeted, in words echoed by Bolivian leader Evo Morales and Argentina's Cristina Kirchner.

But in Washington, the head of the House Foreign Relations Committee, Republican lawmaker Ileana Ros-Lehtinen, accused Chavez of manipulating the result.

"Chavez must not be allowed to continue to export his hate and despotism abroad like his fellow dictators in Iran and Cuba through the oppression of the press and violation of human rights," she said.

Capriles had surged in opinion polls during the campaign as he attracted huge rallies with promises to curb runaway crime and unite the polarized South American country.

The opposition had accused Chavez of misusing public funds for his campaign and dominating the airwaves while forcing government workers to attend rallies through intimidation.

The indefatigable Chavez rose to prominence in 1992 when he led a failed coup against then-president Carlos Andres Perez.

On leaving prison two years later he embarked on a political career, peppering rousing speeches with Biblical quotes and from Bolivar.

Elected Venezuela's youngest president in 1998, at the age of just 44, Chavez set about reforming the constitution and reducing the powers of Congress, easily winning the ensuing 2000 election.

Despite consolidating power, redistributing land and nationalizing the PDVSA oil behemoth to foster his social programs, the economy was in turmoil and Chavez was briefly ousted in a 2002 coup by business leaders. Popular protests saw him reinstated two days later.

A 2004 attempt by the opposition to oust Chavez in a recall referendum was defeated by popular vote.

Elected to a second six-year term in 2006, Chavez then won a 2009 referendum that abolished the two-term limit and enabled him to run indefinitely.

If he lasts until the end of this term, Chavez will have served 20 years as Venezuelan leader.