Gabriel Jesus struck the winner as Brazil put memories of their 2014 World Cup mauling by Germany behind them with a 1-0 friendly win in Berlin on Tuesday.
Jesus' first-half goal at Berlin's Olympiastadion, packed with a 72,717-strong crowd, saw Brazil end Germany's unbeaten run of 22 games dating back to their semi-final defeat by hosts France at Euro 2016.
More worryingly for Germany head coach Joachim Löw ahead of the World Cup in Russia, his captain Jerome Boateng twisted his right ankle and was forced off in the second half.
Measure of revenge for Brazil as German unbeaten run ends
The friendly victory gained a measure of revenge for Brazil, whose coach Tite admitted are still haunted by the 7-1 thrashing Germany handed the hosts in the semi-finals of the last World Cup.
Defending world champions Germany are now winless in their last four games after draws against England, France and Spain.
Löw made seven changes from the team which started the 1-1 draw with Spain last Friday and included just two World Cup-winners.
With Thomas Müller and Mesut Özil rested, Boateng and Toni Kroos were the only members of the Germany team which routed Brazil nearly four years ago.
With Brazil star Neymar still sidelined by a foot injury, Tite made just one change - Fernandinho for Douglas Costa - from the side which beat Russia 3-0 in Moscow on Friday.
Berlin-born Boateng captained Germany after Sami Khedira failed to recover from a back injury.
Centre-back Boateng was the first to react to an early threat, snuffing out an attack when Paulinho got in behind the defence with 15 minutes gone.
Germany striker Mario Gómez failed to convert a string of half-chances which came his way before Brazil scored after sustained pressure.
Jesus heads winner shortly before half time
Jesus, still just 20, forced Germany goalkeeper Kevin Trapp to push the ball over the bar just before the winning goal came on 38 minutes.
The Manchester City forward met Willian's cross, and Trapp could only parry his header, which looped over the line.
After the break, Brazil had two chances in quick succession as Paulinho and Willian were denied by Antonio Rüdiger and Trapp, before Philippe Coutinho fired over on 56 minutes as the Seleçao kept the pressure on.
Jesus should have scored his second of the game when he headed just wide when the ball bobbled loose from a corner.
Löw added a second striker for the final 10 minutes when RB Leipzig forward Timo Werner replaced Ilkay Gündogan as Germany finished strongly - particularly when Julian Draxler's powerful effort was tipped over by Alisson - but to no avail.
Germany vs Brazil: international friendly live updates
Germany vs Brazil: match preview
Germany host Brazil tonight in a friendly that is the teams' first meeting since the South Americans' humiliating 2014 World Cup defeat to Die Mannschaft on home soil.
Just as they were in that 7-1 semi-final thrashing in Belo Horizonte, the Brazilians are without the injured Neymar, while Fernandinho replaces Douglas Costa in what the Seleçao's coach, Tite, said on Monday would be the only difference to the side that beat Russia 3-0 on Friday.
The Manchester City man's inclusion in the engine room is expected to see Philippe Coutinho, who netted a penalty as one of the midfield three in Moscow, move into a more advanced role.
Meanwhile, Joachim Löw has made several changes to the Germany team that drew 1-1 with Spain on Friday. As Löw confirmed on Monday, defender Marvin Plattenhardt and midfielder Ilkay Gündogan both feature, while Kevin Trapp starts in goal, with the Germans' boss revealing on the eve of the game that he and Bernd Leno would share the keeping duties. Antonio Rüdiger, Leroy Sané, Leon Goretzka and Mario Gómez also come in.
Emre Can, Mesut Özil and Thomas Müller - who was the Germans' scorer against Spain - all dropped out of Löw's squad after the stalemate in Düsseldorf.
Germany XI: Trapp, Kimmich, Boateng, Rüdiger, Plattenhardt, Gündogan, Kroos, Sané, Draxler, Goretzka, Gómez
Brazil XI: Alisson, Dani Alves, Thiago Silva, Miranda, Marcelo, Fernandinho, Casemiro, Paulinho, Coutinho, Gabriel Jesus, Willian