President Hugo Chavez has claimed a "victory for the Venezuelan people" after the release of results indicating he won a referendum on his rule.
"Chavistas" have been celebrating outside the presidential palace
Officials from the National Electoral Council said that, with 94% of ballots counted, Mr Chavez had 58% of the vote.
Opponents rejected the outcome as a fraud, insisting they had won.
But former US President Jimmy Carter endorsed the results, saying they tallied with the findings of his referendum monitoring team.
It now seems clear the opposition desire to force Mr Chavez from office failed as previous attempts did, the BBC's James Menendez in Caracas says.
There was a large turnout for the vote, in which Venezuelans were asked whether Mr Chavez should serve out the remaining two-and-a-half years of his term.
Had he lost, fresh presidential elections would have been called in 30 days.
The high turnout in Sunday's referendum meant some people queued all day and authorities were twice forced to extend voting hours.
In the early hours of Monday morning members of the electoral council, the CNE, announced that preliminary results put Mr Chavez a clear 16 points ahead of his opponents.
CNE president Francisco Carrasquero said the results meant Mr Chavez should remain in office until January 2007.
Though Mr Chavez has not yet been declared the outright victor, his lead is virtually unassailable.
The opposition had not only to secure an absolute majority but also more votes than the 3.76 million Mr Chavez received in the 2000 elections.
Fireworks exploded across the capital Caracas before dawn.
There were wild scenes outside Miraflores presidential palace, where Mr Chavez serenaded thousands of cheering supporters from a balcony.
"It is absolutely impossible that the victory of the 'no'
be reversed," Mr Chavez said.
"This has been a great victory for the Venezuelan people."
Mr Chavez also promised stability on Venezuela's oil market - an important assurance for international watchers, given Venezuela's position as one of the world's biggest oil exporters, say correspondents.
Mr Chavez's opponents are dismayed by the preliminary results
The results came as a shock to the opposition, which only hours before had appeared beaming before reporters, after their own private exit polls put them ahead.
"One cannot consider as official the partial results which part of the CNE leadership wants to announce," said Sobella Mejia, one of the electoral council's five members.
A spokesman for the Democratic Co-ordinator opposition coalition, Henry Ramos Allup, said fraud and "gross manipulation" had taken place.
"We categorically reject the results," he said.
Venezuela was polarised by the surprise victory of Mr Chavez - Venezuela's first president from an indigenous heritage - in presidential elections in 1998.
His opponents, who are mostly white, middle-class and control most of the media and business, say he is authoritarian and has managed a rich economy badly.
Despite the country's oil wealth, 80% of Venezuelans are poor but Mr Chavez has won the hearts of many with extensive school and health programmes, analysts say.
The opposition has fought a tireless campaign to see him ousted. Mr Chavez survived a short-lived coup in April 2002 and a two-month strike that badly damaged the economy later that year.
The referendum was activated after the opposition collected signatures from 20% of the population - a recall mechanism inserted into the Venezuelan constitution by Mr Chavez in 1999.
If his victory is confirmed, it will be the eighth time Mr Chavez has won public approval of his rule and his policies, after two presidential elections and six referendums.
Observers say this referendum is unlikely to put an end to the conflict. They warn that in fevered Venezuela violence is never far away.