The holders eased to victory over Atletico Madrid in their opening game and then saw off Lokomotiv Moscow but looked as though they might come unstuck in Austria when Masaya Okugawa levelled matters at 2-2 in the 66th minute - just 54 seconds after he was introduced as a substitute.
Jerome Boateng, Leroy Sane, Lewandowski and Lucas Hernandez all scored inside the final 11 minutes to clinch the points, however, with Bayern earlier bouncing back from Mergim Berisha's opener to lead through a Lewandowski penalty and Rasmus Kristensen's own goal.
The late show leaves Bayern sitting pretty at the summit of Group A with nine points, five ahead of second-placed Atletico Madrid. Salzburg, meanwhile, are bottom having picked up just one point from their opening three games.
Bayern started slowly and fell behind for the first time in 11 Champions League games when Berisha slotted past Manuel Neuer at his near post after Sekou Koita's shot had deflected into his path.
Gnabry had a superb effort disallowed for offside before Lewandowski scored his first Champions League goal of the campaign, slotting home from 12 yards after Thomas Muller had been tripped by Enock Mwepu, having seen an earlier spot-kick award overturned.
Bayern then forged ahead in the 44th minute when Kristensen headed Muller's cross into his own net from close range.
Kingsley Coman clipped the crossbar from 10 yards shortly after the hour mark, but substitute Okugawa equalised for Salzburg with his first touch after Lewandowski had been caught in possession.
Bayern stormed back in the closing stages, though, Boateng putting the Bundesliga champions back in front with a powerful header from Joshua Kimmich's corner in the 79th minute.
Substitute Sane superbly curled into the top-left corner four minutes later after being teed up by Kimmich, while Lewandowski grabbed his second two minutes from time with a back-post header from Javi Martinez's cross.
The scoreline was then given a final flourish in stoppage time when Hernandez lashed into the roof of the net to cap a third group-stage win in style.
What does it mean? Dogged Salzburg crumble at the death
Despite the emphatic nature of the scoreline, Bayern did not have it all their own against an impressive Salzburg side, who forced Neuer into eight saves from their 18 shots.
Bayern's firepower ultimately proved too strong for Jesse Marsch's men, though, as they stretched their unbeaten away run in the Champions League to 15 games, with only Manchester United (16 between 2007 and 2010) having achieved a longer such streak.
Kimmich the creator
Kimmich's superb form in the Champions League continued, with his two assists from five chances created taking his goal involvements in his past six games in the competition to nine (two goals, seven assists). He also completed 92 per cent of his passes - the second-highest rate of any Bayern starter.
Mwepu's game to forget
His clumsy foul on Muller led to the penalty for Bayern's first goal and things did not get much better after that for Mwepu. The Zambia international lost possession a team-high of 18 times and won just 30.8 per cent of his 13 duels.
Key Opta Facts
- Salzburg have lost all five of their Champions League matches against the reigning champions by an aggregate scoreline of 16-5.
- There have been seven matches in which a side has scored six or more goals in a Champions League game since the start of last season, with Bayern responsible for four of them.
- Lewandowski has scored all 12 penalties he has taken in the Champions League (two for Borussia Dortmund, 10 for Bayern).
- Okugawa's equaliser came just 54 seconds after he came off the bench - the second-fastest goal from a substitute in the Champions League this season after Vinicius Junior against Shakhtar Donetsk at 11 seconds.
- Only Real Madrid (16) and Barcelona (15) have benefited from more own goals in Champions League history than Bayern (13).
Bayern travel to Borussia Dortmund for Der Klassiker on Saturday before the international break, while Salzburg visit Rapid Vienna in domestic action a day later.