Lorenz Assignon scored the decisive spot kick after Stuttgart goalie Alexander Nuebel saved three times in the shoot-out.
Arjen Robben has warned his team-mates to avoid anything 'strange' from happening when the Bundesliga leaders host bottom side Eintracht Braunschweig on Saturday.
Bayern have now gone 37 league matches since their last defeat after a 3-0 victory at home to Augsburg.
The hard fought result was enough to extend their remarkable record of not having lost a top-flight game in more than a year.
The European champions were held to a 1-1 draw at Freiburg after they leaked a late equaliser.
The 29-year-old, who scored Bayern's winning goal in May's Champions League final against Dortmund, only returned to the starting line-up last season after injury to Toni Kroos, but the he said competition for places is a healthy thing in the Bayern ranks.
Munich coach Pep Guardiola gave Goetze 30 minutes off the bench in a friendly at Hungarian champions FC Gyor.
Arjen Robben opened the scoring with a deft flick from Franck Ribery's sublime pass in the 12th minute, Mario Mandzukic pounced to make it 2-0 four minutes later, and David Alaba sealed the result with a penalty in the 69th minute.
Mueller's hat-trick - one a penalty - and goals by Swiss Brendan Shaqiri and Dutch veteran Arjen Robben saw them dispose of their hosts and into Saturday's second round draw.
Both teams have new managers at their respective helms as ex-Barcelona boss Guardiola experiments with his starting line-up, including Germany star Bastian Schweinsteiger, who celebrated his 29th birthday.
Schweinsteiger pipped teammates Franck Ribery and Thomas Mueller with 92 out of 527 votes with Ribery on 87 and Mueller on 85.
Thomas Mueller, Franck Ribery and Bastian Schweinsteiger from the German champion were also selected by journalists from UEFA member countries. The award is presented on August 29 at the Champions League group-stage draw in Monaco.
Five young footballers, to be selected from a camp involving over 45,000 aspirants from 800 schools across 120 cities in India, would be rewarded with berths in the annual international football camp in Munich in August.
After winning the Champions League title, Bayern's 3-2 win over VfB Stuttgart in Saturday's German Cup final saw them become Germany's first team to win the treble of European, cup and league titles.
Bayern take on the Catalan giants at the Camp Nou in Wednesday's Champions League second leg with one foot in the final after the drubbing meted out to Messi and his men in Munich.
Despite the advantage, Bayern know how tough life could be at the Camp Nou, having lost 4-0 on their last Champions League visit to Barcelona in the 2009 quarter-final, first leg which they went on to lose 5-1 on aggregate.
Munich eased past a below-par Juve side 2-0, with goals from Austrian defender David Alaba and Thomas Mueller, too all but guarantee a semifinal spot,
Bayern bossed the first half of the last 16, first leg, and went in 2-0 up at half-time through goals from Toni Kroos and Thomas Mueller. Mario Mandzukic struck late in second half to seal the match.