Hugo Chavez pledged to become a "better president" and work with the opposition after winning a tough re-election battle that betrayed simmering discontent at his socialist revolution.
The leftist president's victory was a relief to like-minded allies in the region, with Cuban leader Raul Castro hailing his friend's "historic triumph," while the United States urged him to listen to the opposition.
After almost 14 years in power, Chavez survived cancer and the most formidable opponent of his presidency, youthful former state governor Henrique Capriles, to win Sunday's election and another six-year term.
The anti-US firebrand vowed to deepen his oil-funded socialist revolution after hailing his "perfect" victory.
But he also reached out to disenchanted voters by pledging to work with the opposition, a tacit acceptance that this was a narrower victory than in the past and that Venezuela is a country very much divided.
"I want to include everybody, including sectors of the opposition," Chavez, wearing his trademark red shirt, told thousands of cheering supporters from the balcony of his Miraflores presidential residence.
"I commit to being a better president than I've been these past few years," the 58-year-old leader said. Alluding to his cancer battle, he said: "I thank God and ask him life and health to keep serving the Venezuelan people."
Picked by the once divided opposition in an unprecedented primary, Capriles, 40, was able to woo voters from Chavez with promises to curb rising crime, reform the oil-dependent economy and unite the polarized nation.
After a massive 81 percent turnout, Chavez won 55 percent, or nearly eight million, of the votes, while Capriles gave the opposition its best score against the president, 44.39 percent, or 6.4 million ballots.
In 2006, Chavez thrashed opposition candidate Manuel Rosales, taking 62 percent of the vote and winning by a massive 25-point margin.
"The opposition is strengthened, with a clear leadership and many options for the future," Luis Vicente Leon, president of the Datanalisis polling firm, told AFP after Sunday's much closer result.
"Chavez won without a doubt, I'm not minimizing it, he's a political monster. But it's not the same elections as 2006. Now the opposition has a leader who can seize on its unity," he said.
Chavez can still count on a devout following among the country's long-neglected poor, who adore him for the social "missions" that give them free health care, subsidized food, and sometimes housing.
"Venezuela will continue its march toward the democratic socialism of the 21st century," Chavez said in his victory speech.
But Capriles attracted huge crowds at rallies and his picture could be seen on some homes in Chavez slum bastions after the sports-mad candidate visited 300 towns in a high-octane campaign across the nation.
While accepting defeat with grace, Capriles vowed to continue fighting for the 6.4 million people who voted for him.
"The people contributed to opening a new path and this path is here," Capriles, wearing a jacket in Venezuela's yellow, blue and red colors, told supporters late Sunday.
"I am also on this path and I won't leave almost half the country alone," he said.
Some 200 Capriles supporters, many in tears and disbelief, massed outside his campaign headquarters.
"I'm disappointed but not defeated," said Rosana Gonzalez, a 25-year-old student. "I continue to believe in his project for the country."
The United States and the European Union urged Chavez to extend a hand to the opposition.
"We have our differences with President Chavez," White House spokesman Jay Carney told journalists. "But we congratulate the Venezuelan people" on the peaceful manner in which the election was carried out, he added.
"We believe that the views of the more than six million people who voted for the opposition should be taken into account going forward," said William Ostick, a US State Department spokesman.
EU foreign policy chief Catherine Ashton congratulated Chavez while also urging him "to reach out to all segments" of society.
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 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.
Castro pledged Cuba's "solidarity and unbreakable support," while Bolivian President Evo Morales called his fellow leftist's triumph "a victory for the Bolivarian alliance and all of Latin America."