The striker came off the bench to ensure that Pep Guardiola's men are guaranteed to qualify from the group stage, while equalling Barcelona's win recordBayern Munich struggled to a slender 1-0 win over Viktoria Plzen to qualify for the last 16 and equal Barcelona's record of Champions League wins in a row on Tuesday.
Pep Guardiola went into the game lamenting his side's recent struggles to dominate teams, and they once again failed to blow away the Czech champions, despite enjoying 72 per cent possession and raining 14 shots at goal.
Plzen goalkeeper Matus Kozacik was in supreme form, while Bayern's own patience in front of goal was often their own downfall.
Second-half substitute Mario Mandzukic netted just six minutes after coming on to secure the points, heading Philipp Lahm's cross past Kozacik.
The hosts were unchanged from their 6-1 crushing of Jablonec last weekend, but Guardiola shuffled his pack after Saturday's struggle to beat Hoffenheim, making four changes and including Diego Contento, a left-back by trade, in the heart of defence.
The 23-year-old immediately looked shaky in his converted position as he appeared to haul Stanislav Tecl down in the penalty area, but referee Antonio Mateu was unmoved.
Bayern quickly asserted their dominance as Plzen goalkeeper Kozacik was twice called into action from distance by David Alaba, while Bastian Schweinsteiger rattled the post from Mario Gotze's cut-back.
Guardiola's side poured forward, but were not creating clear-cut chances as the Czechs stood resolute at the back and almost grabbed a shock lead. Milan Petrzela squirmed clear, but his left-footed shot sailed over the crossbar as Bayern's first-half frustrations went on until the half-time whistle
Bayern came out for the second half with renewed vigour and Lahm was denied his first Champions League goal just four minutes after the break as he prodded past Kozacik, but Marian Cisovsky slid across to deny the Bavarians' captain.
Daniel Van Buyten flicked a header wide from a corner, with Thomas Muller just missing out on a tap-in at the far post and Franck Ribery was denied one-on-one by the inspired Kozacik as Bayern turned the screw.
With Bayern still unable to break the deadlock, Guardiola introduced Mandzukic and Javi Martinez for Muller and Schweinsteiger, and the changes had the desired effect within six minutes of being made.
Lahm pulled out to the right and swung a deep cross to the back post that Mandzukic planted across goal and past the despairing dive of Kozacik.
Tecl brought Manuel Neuer into action with a low drive before missing Petrzela's cross by inches as Plzen hit back in the hunt for an equaliser.
Bayern should have settled the game late on as Gotze rounded Kozacik, but he took the ball too far and Mandzukic could not convert his cross, but it mattered for little as the holders sealed their progression from Group D.