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
-
Keynote speakers arrive in Paris for Women of Valour
3 hours -
Prosecutors demand Luis Rubiales World Cup kiss retrial
5 hours -
Ghana won’t sink any further, investors must stay – Ishmael Yamson
5 hours -
Dr. Louisa Satekla pays courtesy call on Haruna Iddrisu to promote oral health education
5 hours -
Coastal Civil Society Forum engages tidal wave victims, calls for urgent gov’t action
5 hours -
ECB apologises for Pope Francis Ashes post joke
5 hours -
Denmark postal service to stop delivering letters
5 hours -
Photos: Mahama visits victims of tidal waves destruction in Volta region
5 hours -
Teen armed with gun overpowered by passengers onboard plane
6 hours -
Ghana Month: From war airbase to global gateway – KIA’s evolution and Ghana’s airline struggle
6 hours -
Rosetta Quaicoe: Preventing future Cholera outbreaks in Takoradi: A public health imperative
6 hours -
Edward Bawa assumes office as Acting Group CEO & MD of GOIL PLC
6 hours -
Ghana’s economy to face greater external stability in 2025; reserves to hit $8.8bn in 2025
6 hours -
Ghana’s current account balance to remain positive at 1.8% in 2025 – Fitch Solutions
6 hours -
Mahama directs Finance Minister to fund Blekusu Sea Defence Phase II
6 hours