Missed chances by Robert Lewandowski on his return to Bayern Munich proved costly as his Barcelona side lost in Germany.
Outplayed in the first half, Bayern blew their Spanish opponents away after the break with goals from Lucas Hernandez and Leroy Sane.
Hernandez headed in at the near post after 50 minutes, before Sane clipped home to seal the win shortly after.
Lewandowski spurned a number of clear openings in an entertaining match.
The victory puts Bayern Munich in control of Group C with six points from two games.
Barcelona are level on three points with Inter Milan, who beat Viktoria Plzen 2-0 in the Czech Republic through goals from Edin Dzeko and Denzel Dumfries.
This absorbing encounter between two European heavyweights more used to meeting in Champions League knockout games rather than the group stage was Lewandowski’s first return to Bayern since his move to Xavi’s Barcelona last summer.
Despite a protracted transfer saga after the 34-year-old openly stated his desire to leave the Bundesliga champions, the Munich fans seemed to bear little ill will, giving the Pole a good reception before the game.
Lewandowski had scored nine goals in six games for his new club before Tuesday night, but he missed several good first-half chances at the Allianz Arena.