The Spaniard, who won 14 of 19 possible titles in four years at Barcelona, made sweeping role changes as he works his way into the new job after the Bavarians won the Champions League and domestic league and Cup double last season under Jupp Heynckes.
Against a second-string Barcelona, missing new coach Gerardo Martino and big signing Neymar as well as midfielders Xavi and Andres Iniesta among others, Guardiola started the game without a striker.
Captain Philipp Lahm was pushed forward into an offensive midfield role after years of playing as right back and recent signing and former Barcelona talent Thiago Alcantara moved straight into midfield.
The move paid off in the 15th minute when the diminutive Germany international headed in a smooth Franck Ribery cross.
Bayern, who crushed Barcelona over two legs in the Champions League semi-final last season, were the sharper team in the first half, with their impressive depth in the squad on full display.
With both teams still in pre-season training, both coaches made many changes in the second half with the game losing its pace and edge.
Forward Mario Mandzukic, who came on as a substitute, added another goal late in the game, tapping in from close range.
After the friendly, Guardiola shook hands with Barcelona’s assistant coach Jordi Roura who deputised for Villanova while he received treatment.