The country's electoral authority said just after midnight on Monday that Maduro had won a third term with 51% of the vote, despite multiple exit polls which pointed to an opposition win.
The authority said opposition candidate Gonzalez won 44% of the vote, though the opposition had earlier said it had "reasons to celebrate" and asked supporters to continue monitoring vote counts.
Maduro, appearing at the presidential palace before cheering supporters, said his reelection is a triumph of peace and stability and reiterated his campaign trail assertion that Venezuela's electoral system is transparent.
He will sign a decree on Monday to hold a "great national dialogue," Maduro added.
Fireworks sounded over Caracas, as lighted drones formed a brightly-colored image of Maduro in the sky above the presidential palace.
Opposition leader Maria Corina Machado said Gonzalez had won 70% of the vote and that multiple independent exit polls and quick counts decisively showed his victory.
"Venezuela has a new president-elect and it is Edmundo Gonzalez. We won and the whole world knows it," she said in a joint statement with Gonzalez.
Gonzalez said he was not calling for supporters to take to the streets or commit any acts of violence.
A poll from Edison Research, known for its polling of U.S. elections, had predicted in an exit poll that Gonzalez would win 65% of the vote, while Maduro would win 31%.
Local firm Meganalisis predicted a 65% vote for Gonzalez and just under 14% for Maduro.
U.S. Secretary of State Antony Blinken said the United States had "serious concerns that the result announced does not reflect the will or the votes of the Venezuelan people."
Blinken called for electoral authorities to publish a detailed tabulation of votes.
About 80% of ballot boxes have been counted, said national electoral council (CNE) president Elvis Amoroso in a televised statement, adding results had been delayed because of an "aggression" against the electoral data transmission system.
The CNE has asked the attorney general to investigate the "terrorist actions" Amoroso said, adding participation was 59%.
The CNE is meant to be an independent body, but the opposition alleges its acts as an arm of the government.
The top opposition official meant to witness the overall national count was not allowed to and there were several polling stations where opposition observers were not allowed to observe, the opposition said on Sunday night.
Earlier Machado reiterated a call for the country's military to uphold the results of the vote. The opposition says it has copies of about 40% of voting records.
"A message for the military. The people of Venezuela have spoken: they don't want Maduro," she said earlier on X. "It is time to put yourselves on the right side of history. You have a chance and it's now."
Venezuela's military has always supported Maduro, a 61-year-old former bus driver and foreign minister, and there have been no public signs that leaders of the armed forces are breaking from the government.
Street fights
Machado has been the star of the coalition campaign, despite a ban on her holding public office that forced her to pass the torch to Gonzalez, a 74-year-old ex-diplomat known for his calm demeanor.
Gonzalez won backing even from some former supporters of the ruling party, but the opposition and observers raised questions ahead of the vote as to whether it would be fair, saying decisions by electoral authorities and the arrests of opposition staff were meant to create obstacles.
Maduro – whose 2018 reelection is considered fraudulent by the United States, among others - had warned last week of a "bloodbath" if he were to lose.
Attorney General Tarek Saab told Reuters on Sunday evening that he did not anticipate any violence and that except for some isolated incidents voting had been peaceful.
Less than a block from Saab's office in central Caracas, dozens of ruling party supporters arrived together on motorcycles outside Andres Bello secondary school, the country's largest voting center, scuffling with opposition supporters gathered outside.
The crowd dispersed after about 20 minutes, but videos on social media showed similar incidents in other locations around the country.
The Venezuelan Observatory of Social Conflict said on X that armed groups of the motorcycle-riding ruling party supporters known as 'collectives' were reported in six states and Caracas.
One man died of a gunshot wound in the border state of Tachira after a collective attacked people outside a polling place, the Observatory said. Reuters could not independently verify the details of the incident.
Reuters journalists in seven locations around the country had reported morning lines outside polling stations, including some that opened late or where voting was moving slowly. Many voters had arrived before dawn.
"I work cleaning houses and my four grandchildren depend on me. I earn just $15 per week and that is enough to eat one day but not the next," said Luisa Gonzalez, 61, who voted in the state of Bolivar, traditionally a ruling party bastion.
"I was a Chavista, but people have changed," she said, using the term for ruling party supporters, a reference to the late President Hugo Chavez.
Maduro's government has presided over an economic collapse, the migration of about a third of the population, and a sharp deterioration in diplomatic relations, crowned by sanctions imposed by the United States, the European Union and others which have crippled an already struggling oil industry.
Maduro said if returned to power he would guarantee peace and economic growth, making Venezuela less dependent on oil income.
The Chavez legacy
Maduro voted early in the morning in Caracas and said the result announced by the electoral authorities would be recognized and defended by the armed forces and the police.
Maduro said he would decree a national dialogue on Monday, using a term that typically means conversations between the government and opposition, businesses, communities and others.
Many Maduro supporters speak enthusiastically of his mentor Chavez, and see Maduro, in power since Chavez's death in 2013, as a continuation of Chavez's legacy of helping the poor.
Others told Reuters they saw Maduro's record as mixed but that they would back him.
"There are things that without doubt need to improve in our country, but this government has lived through sanctions and blockades like no other. That's why I back President Maduro and think he deserves another chance," said Jose Lopez, 57, as he waited to vote in central Valencia.
Gonzalez and Machado promised major changes and said a fresh start may motivate migrants to return.
Forty-six people have been arbitrarily detained since Friday in connection with the elections, Gonzalo Himiob, the vice president of human rights organization Foro Penal, said on X late on Sunday, and at least 23 remain detained.
Saab this week denied participating in political persecution.
Migrants around the world reported difficulties registering and only a small percentage of the large Venezuelan diaspora was registered to vote.