Rafael's unstoppable extra-time thunderbolt proved to be a deserved winner for the Brazilians as they hit back to deny Germany at the sweltering Willem II Stadium.
A delighted Brazil coach Rene Weber said: "Even when we were 1-0 down with just minutes to go, I knew that we would fight to the end and succeed. When we went with three in attack, I knew something would have to happen."
Hot and humid conditions greeted the players and before the kick-off, the goalkeepers and team captains, Rene Adler of Germany and Renan of Brazil, read out a statement supporting FIFA's Anti-Discrimination Day 2005. The message was warmly received by the fans.
When battle commenced, both sides seemed reluctant to force the pace and it was a full 15 minutes before the first shot in anger was fired, with Brazil's Rafael Sobis dragging his right-foot drive just the wrong side of Adler's post.
Germany then had a great opportunity to forge ahead when Christoph Janker's cross from the right avoided everybody until it landed at the feet of left-back Marvin Compper 12 yards out, but he skewed his effort horribly wide.
It was Brazil who gradually assumed the greater authority in the first half as they demonstrated their skilful, but patient passing game until the right moment to strike arrived. After one such build-up, Arouca brought an important save out of Adler, diving low to his right.
Whenever they were able to, Germany refused to sit back and let Brazil take the game to them and Marcell Jansen almost embarrassed Renan with a fierce shot that slipped through his fingers but passed over the bar.
Moments into the second half, Brazil should have gone in front, but after bringing the ball under control near the penalty spot, Sobis slashed wildly at it and wasted the opening.
Fabio Santos then brought Adler off his line to make a telling block and from the resulting corner, Edcarlos could not get enough meat on his free header and it glanced wide.
Adler knew nothing of his next save as a fierce shot by Santos cannoned off his chest and ballooned skywards - Brazil were no longer willing to hang around it seemed.
Germany also appeared to be a more enthusiastic version of themselves after the restart as Jansen and Christian Gentner both went close before they eventually went ahead against the run of play. Substitute Alexander Huber got the goal - an ugly one at that - and it owed much to a big deflection off Santos as the Eintracht Frankfurt midfielder bundled home a hanging corner from the left (1:0, 68').
The Brazilian equaliser was as spectacular as it was beautiful, with Edcarlos smashing an acrobatic overhead kick against the crossbar before Diego Tardelli followed up to head home the rebound with Adler stranded (1:1, 82').
Evandro could have spared everyone the ordeal of extra-time, but his late, late header skimmed the top of the German net and Brazil also had one extremely vocal penalty appeal turned down.
Rafael's decisive goal was well worth waiting for though… a real cracker as Germany failed to clear a corner and the galloping defender charged onto the loose ball and absolutely smashed it past Adler at full stretch (1:2, 99').
Sobis and Thiago Quirino should have made the last five minutes a lot more relaxing for Brazil as their superiority finally started to show, but after finding themselves clean through on goal, they somehow failed to hit the target.
Goalscorer Tardelli was later sent off with the clock running down as he got his second yellow card for diving in an attempt to gain a penalty.
Germany coach Michael Skibbe admitted: "The better team won, but on the other hand there were only a few minutes left when Brazil made it 1-1. It was an excellent game for the whole 120 minutes."