RIO DE JANEIRO (AFP) - Germany handed departing coach Silvia Neid the perfect send off by claiming women's football Olympic gold for the first time thanks to a 2-1 win over Sweden in front of a huge crowd at Rio's Maracana.
Dzsenifer Marozsan's sweet strike and Lisa Sembrant's comical own goal put Germany 2-0 up early in the second-half before Stina Blackstenius gave Sweden a lifeline.
Canada beat hosts Brazil 2-1 in Sao Paulo earlier on Friday to claim bronze.
With Brazil's men taking on Germany in their final tomorrow, the boisterous home crowd roared on the Swedes in the final stages. However, it was to no avail as Sweden boss Pia Sundhage missed out on a third consecutive Olympic title after leading the USA to gold in 2008 and 2012.
Victory handed Neid a golden goodbye in her last game after a hugely successful 11 years in charge, including wins at the 2007 World Cup and 2009 and 2013 European championships.
Sweden had been criticised, most notably by outspoken USA goalkeeper Hope Solo, for their defensive tactics in upsetting the world champions and Brazil in the previous two rounds on penalty shootouts. However, they started on the front foot against the two-time world champions and should have gone in front when Olivia Schough spooned over Lotta Schelin's low cross.
Germany went onto have the better chances in the first-half, though, as Melanie Leupolz headed over from close range before Anja Mittag somehow blasted wide with the goal gaping.
Marozsan showed much more composure with the first opening of the second-half as the Lyon forward curled the ball beautifully into the top corner.
Another Marozsan effort provoked Germany's second as her free-kick came back off the post and Sembrant's panicked clearance sent the ball crashing back into her own goal.
Sweden, having scored just three goals in reaching the final, finally showed their attacking abilities with a well-worked move finished off by Blackstenius five minutes later.
Schough had a huge chance to equalise five minutes from the end, but some frantic German defending finally managed to hack the ball clear.
Canada completed the podium as hosts Brazil lost for the second time in three days to miss out on a medal.
Goals either side of half-time from Deanne Rose and veteran captain Christine Sinclair on her 250th international appearance silenced a passionate crowd and saw Canada defend the bronze medal they won in London four years ago.