Rio Olympics 2016: Brazil beat Germany on penalties to win men's football gold
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.
Nigeria win first medal of the Games
Nigeria won their first medal of the 2016 Olympics as they beat Honduras 3-2 in the bronze-medal match, with Sadiq Umar scoring twice and Aminu Umar scoring once.
Chelsea midfielder John Mikel Obi, who captained the Nigeria side, said: "I am so proud of this team, the boys worked so hard.
"It is very important, because football in Nigeria is absolutely massive. We had extra pressure perhaps, but we have done it for us, for our family, for Nigeria."
Nigeria held a 3-0 lead before Honduras, who qualified from the group phase at Argentina's expense, scored twice through Antony Lozano and Marcelo Parera to set up a tense conclusion.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.