Formiga, Marta and a Cristiane brace did the damage, cancelling out a Birgit Prinz strike to set up a gold medal match against either defending champions the United States or Japan in Beijing on Thursday.
Prinz got the opener on 10 minutes, making the breakthrough after a nervy start by both sides. As she so often has in the past, the German captain used her brute strength to muscle her way past a defender and into the box before calmly rounding goalkeeper Barbara and side footing home.
Rattled, Brazil looked to their three most creative players - Cristiane, Marta and Daniela - for inspiration and they duly delivered.
Daniela was proving a handful down the left and it was from her efforts that the South Americans almost got an equaliser with five minutes left in the half. Her deep cross dropped at the feet of defender Simone only for Germany's Kerstin Garefrekes to make a crucial tackle and put the ball behind for a corner.
The near-miss sparked Brazil to life and three minutes later they were level after Cristiane sent a low cross into the box to the advancing Formiga who smashed the ball into the net from 20 yards. It panicked the world champions who let their guard down again barely a minute later, allowing Marta to strike a long-range effort that goalkeeper Nadine Angerer did well to tip over the bar.
Brazil came out after the break just as determined and were ahead within four minutes after Marta picked up the ball just inside her own half and went rampaging down the middle of the park with Germany caught napping. Drawing the defenders, she laid off the ball to Cristiane in acres of space and the 23-year-old made no mistake for her fourth goal of the tournament.
Brazil had another on 53 minutes when Marta rounded two defenders as she cut into the box on the right before burying the ball with the outside of her left boot.
Germany's back line was at fault again for the fourth goal when Cristiane danced past three defenders before cooly placing the ball past the oncoming Angerer with 14 minutes left.
Brazil and Germany have been the eternal runners-up of Olympics football. The Brazilians lost the Athens final in 2004 in extra time by 2-1 to the USA while Germany have won bronze in their last two Games. They defeated Brazil in the third-place play-off in Sydney in 2000.