Maduro's stunningly close victory over Henrique Capriles came after a campaign in which the winner promised to carry on Chavez's self-proclaimed socialist revolution while the challenger's main message was that Chavez's 14-year regime put Venezuela on the road to ruin.
Maduro, acting president since Chavez's death, held a double-digit advantage in opinion polls just two weeks ago, but electoral officials said he got just 50.7 per cent of the votes to 49.1 per cent for Capriles with nearly all ballots counted.
Chavistas set off fireworks and blasted car horns as they cruised downtown Caracas in jubilation.
At Capriles' campaign headquarters, people hung their heads quietly as the results were announced by an electoral council stacked with government loyalists.
Many started crying; others just stared at TV screens in disbelief. "I can't believe this. This can't be happening. The votes should all be recounted to be 100 per cent sure who won," said Jenny Morales, 26, a volunteer who handed out posters and leaflets during the campaign.
The mood lightened after another electoral council director, Vicente Diaz, proposed an audit of the vote.
There was no immediate word from Capriles, but Maduro addressed a crowd from the presidential palace after winning a six-year term.
In a booming voice, he called his victory further proof that Chavez "continues to be invincible, that he continues to win battles."
He said that Capriles had called him before the results were announced to suggest a "pact" and that Maduro refused.