His rival, 40-year-old Miranda state governor Henrique Capriles, was gracious in defeat, saying, "I accept and respect the decision of the people," but it was a bitter pill for the opposition and many in the divided country to swallow.
Fireworks erupted across Caracas as "Chavistas" celebrated in front of the presidential palace after near-complete official results showed Chavez winning 54.42 percent of votes compared to 44.97 percent for Capriles.
"Thank you my dear people!!! Viva Venezuela!!!" Chavez, in power for almost 14 years, wrote on Twitter after the National Electoral Council announced the score. "Thank you God! Thank you to all of you!"
The result after a massive 80.94 percent turnout showed a far tougher contest than Chavez has endured so far to his 14-year tenure. He won the 2006 election with 62 percent of the vote and by a margin of 25 points.
With 90 percent of ballots counted, Chavez won 7,444,082 votes, compared to 6,151,554 for Capriles -- highlighting the deep divisions in the oil-rich South American nation.
Chavez had held a 10-point lead in the latest opinion poll before Sunday's vote, but other surveys had indicated a statistical dead heat.
Hundreds of Chavez supporters assembled before the announcement in front of the Miraflores presidential palace, setting off firecrackers, honking horns and holding signs as his campaign song blared.
Election experts said the electronic voting system was reliable, but suspicions ran high that whoever lost would not concede defeat.
"To know how to win, you have to know how to lose," Capriles said at this campaign headquarters, putting those fears to rest. "For me, what the people say is sacred."
"I am a democrat, through and through," the 40-year-old former state governor said, wearing a jacket in Venezuela's colors.
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. Congratulations came from Argentine President Cristina Kirchner too.
But in Washington, the head of the House Foreign Relations Committee, Republican lawmaker Ileana Ros-Lehtinen, accused Chavez of manipulating the result.
"Chavez has denied access to international election monitors, employed last minute ballot changes, controlled the judicial system, harassed independent journalists, and consolidated his power to manipulate the vote in his favor," she alleged.
"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," said Ros-Lehtinen.
With the polarized nation bracing for the results amid an atmosphere of widespread distrust, Chavez and his rival had both appealed for calm as some booths remained open well after the scheduled closing hour.
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.
Weakened by a bout with cancer, the 58-year-old Chavez stepped up campaigning in the last week of the race, warning that Capriles would undo his popular social "missions" for the poor.
Sitting on the world's biggest proven crude oil deposits, Chavez has used petro-dollars to build a network of regional allies and secure the loyalty of poor Venezuelans dependent on the generosity of his social programs.
Voters began standing in line early after Chavez supporters played military-style bugles before dawn to roust loyalists of the president.
As he arrived to vote in the 23 de Enero slum, one of his Caracas bastions, Chavez was greeted by an adoring crowd with chants of "ooh, ahh, Chavez won't go!"
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.
Capriles has hammered Chavez over the country's regular power outages, food shortages and runaway murder rate, which has risen to 50 homicides per 100,000 inhabitants.