Poland international Lewandowski struck in the 77th minute, flicking in a Kevin Grosskreutz shot with his heel for his 20th league goal of the season that lifted Dortmund to 69 points and left Bayern in second place on 63.
Bayern, whose nine-game winning streak was snapped, missed the chance to level five minutes from time when Arjen Robben had his penalty saved by Dortmund keeper Roman Weidenfeller.
With Germany's football royalty in the stands and 200 countries tuned in for the big match, Dortmund, unbeaten now for a club record 24 straight games, were the better side throughout, even though playmaker Mario Goetze was ruled out after recovering from as groin injury only days ago.
It took the hosts only two minutes to slice open the Bayern defence with a superb through ball by Ilkay Guendogan for Jakub Blaszczykowski to slide the ball past keeper Manuel Neuer but narrowly wide.
Four minutes later Neuer twice denied the hosts, saving Grosskreutz's point-blank effort and then blocking Lewandowski's rebound shot as the atmosphere among the sold-out 80,720 crowd heated up.
The Pole, Dortmund's top scorer, then rattled the post with a powerful header in the 38th as Bayern struggled to keep up with the pace.
The visitors' biggest chance came on the hour but Franck Ribery's low drive from a tight angle sailed just wide of the post before Lewandowski struck 13 minutes from time.
Bayern poured forward for the equaliser and had a golden opportunity to level when Robben was brought down by Weidenfeller five minutes from time.
The Dutchman's weak spot kick was saved by the keeper and minutes later Robben again missed from three metres out, somehow managing to fire over the bar. Lewandowski again hit the woodwork when he chipped Neuer in stoppage time with the ball bouncing off the bar.

