Mathis Bolly put the visitors in front in the 16th minute with Thomas Muller replying on the stroke of half-time.
Andreas Lambertz gave the visitors the lead for the second time in the 71st minute, but Franck Ribery equalised almost immediately afterwards before Jerome Boateng's first goal for Bayern earned them victory late on.
Fortuna were beaten 5-0 at home to Bayern in the reverse fixture, but their coach Norbert Meier said his side would give it all they had on Saturday afternoon.
That is precisely what they did, going ahead in the 16th minute through Bolly.
He became only the ninth player to beat Manuel Neuer this season when he volleyed past Germany's number one after Lambertz headed the ball into the centre for him.
Bayern found themselves in a very rare situation of being behind in a game and they did not seem to have an answer to begin with.
Fortuna harried and hassled, preventing them from getting their usual slick game going.
It was only a matter of time before Bayern did get into the right gear, though, and on the half-hour mark, Toni Kroos missed the target after Muller had sent a shot over from close range.
Fabian Giefer was getting far more to deal with in the Fortuna goal and after denying Daniel van Buyten and seeing a Bastian Schweinsteiger goal ruled out for offside, he was finally beaten just before the interval.
Philipp Lahm teed up Muller, who made no mistake this time with a well-placed shot.
Fortuna did not fall apart and continued to frustrate their hosts before taking a shock lead for the second time.
The ball arrived at Lambertz on the counter-attack and he made his way into the penalty area before beating Neuer with a low shot as Fortuna became only the second side after Bayer Leverkusen to put two past Bayern in a Bundesliga game this season.
It clearly stung the Bavarians, who were level again within two minutes.
Ribery found the right-hand corner of the goal from Claudio Pizarro's assist within seconds of the Peruvian entering the fray.
Boateng then headed Bayern in front in the 86th minute as normal business was resumed from Lahm's cross.