Neymar shed tears of joy after delivering Brazil's first men's football gold medal with the winning penalty in a 5-4 shootout triumph over Germany after a thrilling final ended in a draw following extra-time on Saturday.

Brazil had lost the Olympic final three times - in 1984, 1988 and 2012 - but they finally got the gold they craved on a dramatic night at the Maracana stadium in which they outplayed the Germans but were saved three times by the woodwork.

Neymar had put the hosts ahead with a superb free kick after 27 minutes but Germany captain Maximilian Meyer equalised just before the hour to take the game into the extra period at 1-1.

There were no more goals so the match went to penalties with Nils Petersen missing Germany's fifth spot kick leaving Neymar, who appeared to injure himself late in the game, to limp up and coolly score from the spot to send the capacity crowd wild.

The victory gave Brazil a measure of revenge for their humiliating 7-1 defeat by eventual World Cup winners Germany in the semi-finals on home soil in 2014 - a game the frustrated Neymar had to watch from the sidelines due to injury.

"Yesterday we were criticised," the 24-year-old Barcelona forward said in reference to Brazil's poor start to the Olympic tournament in which the home side drew 0-0 with South Africa and Iraq. "We have replied with good football."

Brazil coach Rogerio Micale added: "We had players who were extremely dedicated, professional and with great technical skill. I'll leave here with the sensation of having done my duty."

The win means a unified Germany are now the only World Cup winners never to have won the Olympic gold medal and the loss robbed them of a chance to complete the male and female double after their women's team beat Sweden 2-1 on Friday.

PASSIONATE CROWD

With a passionate crowd behind them, Brazil took the game to their opponents and dominated possession and territory.

However, they struggled to make chances and it was the Germans who almost opened the scoring after 10 minutes when Julian Brandt smacked the bar with a lovely curling shot from outside the box.

Brazil kept pushing forward and just before the half-hour mark they got the goal that their play deserved.

Neymar was brought down almost 25 metres from goal and, although the angle was tight, he curled a spectacular strike into the net off the underside of Timo Horn's bar.

The goal shook Germany into action and they pushed forward more and hit the bar twice more before the half was out.

Brazil still looked the hungrier side but it was Germany who got the next goal with an hour gone. Jeremy Toljan sent in a low cross from the right and captain Maximilian Meyer swept home a lovely finish from about 10 metres.

Gabriel Jesus almost put Brazil ahead when he touched a Renato Augusto cross wide after 64 minutes and Felipe Anderson should have given the hosts the lead 13 minutes later but he was caught in possession with only the keeper to beat.

Anderson then almost scored 16 minutes into extra time but Horn got down superbly to block his shot as he raced in on goal.

With the sides still level after extra time, the stage was set for Neymar to step up and strike the winning spot kick to send the whole of Brazil into raptures as the country finally captured the Olympic title they had so desperately craved.