Neymar scored the winning penalty as hosts Brazil beat Germany 5-4 on penalties in Rio to win their first men's Olympic football gold medal.
The game finished 1-1 after extra time, with Neymar's first-half free-kick cancelled out by Max Meyer's strike.
In the shootout, Germany's Nils Petersen had his penalty saved by Weverton before Neymar won it.
It comes two years after Germany thrashed Brazil 7-1 in the 2014 World Cup semi-finals in Belo Horizonte.
In front of 78,000 at the Maracana, Brazil got a measure of revenge as they finally won the Olympic title after losing in the finals in 1984, 1988 and 2012.
Barcelona forward Neymar, who missed the World Cup semi-final through injury, opened the scoring with a fine 25-yard free-kick, but the hosts were lucky to go in at half-time with the lead.
Germany hit the woodwork three times in the first half - through Julian Brandt's 25-yard effort, a deflection off a Brazilian defender and Sven Bender's header - before they scored a deserved equaliser shortly after the restart.
Bender passed to the overlapping Jeremy Toljan and he found the unmarked Meyer, who arrowed a low shot into the net.
Neither side could find a winner before the drama of the penalty shootout gave Brazil the gold.
Goalkeeper Weverton said: "The gold is ours, but it belongs to God. God loves Neymar like he loves all this team."
Neymar added: "This is one of the best things that has happened in my life. That's it."
Revenge for Brazil?
Two years ago, World Cup hosts and tournament favourites Brazil suffered their heaviest ever World Cup defeat as they fell 5-0 behind inside 29 minutes on their way to that 7-1 thrashing by the Germans.
Before the Olympic final, Brazil coach Rogerio Micale tried to play down talk of a "revenge" victory.
He pointed out that none of his players were involved in the World Cup semi-final - with the Olympic squads only able to feature three players aged older than 23.
"That was the World Cup, this is the Olympic team,'' said Micale. "Neymar never played in that match so there is nothing that could generate any type of feeling that we have to take revenge.
"It is a different time with different players and ages."
Nevertheless, the capacity crowd created a fantastic atmosphere in the Maracana and got the result they desperately craved.
Latest Stories
-
One dead, 4 injured in multi-vehicle crash on Cape Coast–Takoradi–Accra highway
2 minutes -
AG’s public statements don’t influence judicial rulings – Justice Ackaah-Boafo
6 minutes -
Justice Ackaah-Boafo: Ghana needs more lawyers to match justice system’s demand
35 minutes -
Six new Adinkra symbols unveiled to signify Asantehene’s unparalleled leadership
36 minutes -
GOIL delivers a robust performance in 2024
39 minutes -
Bolt partners with Fido Credit to offer loans to drivers in Ghana
40 minutes -
Ghana Data Science Summit 2025: Empowering the use of data and AI skills for impact.
52 minutes -
Mastercard, Access Bank introduce innovative card to empower Ghanaians
52 minutes -
Republic Bank Ghana and SLCB sign landmark technical support agreement to drive regional banking excellence
1 hour -
Afenyo-Markin slams petition against Supreme Court nominee as “frivolous and dangerous precedent”
1 hour -
Striking gold or sinking fast? A deep dive into Ghana’s Gold Coin and cedi strength
1 hour -
‘Frivolous and vexatious’ – Committee cites constitutional immunity in quashing petition against Justice Ackaah-Boafo
1 hour -
Nii Adama Latse II wins appeal: Court orders House of Chiefs to restore him to register – But Ga Mantse office says King Teiko Tsuru II remains Chief
2 hours -
Black Queens in line for friendlies against Nigeria and two others before WAFCON 2024 opener
2 hours -
Gov’t won’t shield anyone in galamsey fight – Environment Minister
2 hours