President Hugo Chavez waves a Venezuelan flag as he greets supporters at the Miraflores presidential palace balcony in Caracas (AP)
President Hugo Chavez won re-election and a new endorsement of his socialist project, surviving his closest race yet after a bitter campaign in which the opposition accused him of unfairly using Venezuela's oil wealth and his near total control of state institutions to his advantage.
A long wait for the results produced high tensions, including a Twitter hashtag called BitingNails that became the most popular in the country.
Finally, fireworks exploded over Caracas amid a cacophony of horn-honking by elated Chavez supporters waving flags and jumping for joy outside the presidential palace.
With 90% of votes counted, Mr Chavez had more than 54% of the vote to 45% for challenger Henrique Capriles, an athletic 40-year-old former state governor who unified and energised the opposition while barnstorming across the oil-exporting nation.
But Mr Capriles's promises to seriously address violent crime that has spun out of control, streamline a patronage-bloated bureaucracy and end rampant corruption proved inadequate against Mr Chavez's charisma, well-oiled political machine and a legacy of putting Venezuela's poor first with generous social welfare programmes.
Mr Chavez rallied thousands of supporters from a balcony of the presidential palace, holding up a sword that once belonged to 19th century independence hero Simon Bolivar. "The revolution has triumphed!" Mr Chavez told the crowd, saying his supporters "voted for socialism". The crowd responded chanting: "Chavez won't go!"
Mr Chavez will now have a freer hand to push for an even bigger state role in the economy and continue populist programmes. He pledged before the vote to make a stronger push for socialism in the next term. He is also likely to further limit dissent and deepen friendships with US rivals. A Capriles victory would have brought a radical foreign policy shift including a halt to preferential oil deals with allies such as Cuba, along with a loosening of state economic controls and an increase in private investment.
It was Mr Chavez's third re-election in nearly 14 years in office. It was also his smallest victory margin. In 2006, he won by 27%. Voter turnout was an impressive 81%, compared with 75% in 2006. Mr Chavez paid close attention to his military-like get-out-the-vote organisation at the grass roots, stressing its importance at campaign rallies. The opposition said he unfairly put millions in state funds into the effort. Mr Chavez spent heavily in the months before the vote, building public housing and bankrolling expanded social programmes.
Mr Chavez spoke little during the campaign about his fight with cancer, which since June 2011 has included surgery to remove tumours from his pelvic region as well as chemotherapy and radiation treatment. He has said his most recent tests showed no sign of illness.
Mr Capriles told supporters not to feel defeated. "We have planted many seeds across Venezuela and I know that these seeds are going to produce many trees," he told a hall of supporters. Despite winning a February primary that unified the opposition, Mr Capriles proved no match for Mr Chavez's electoral prowess.