For the Bavarians, already crowned German champions, the defeat was their second in a row in the league after a record 53-game unbeaten run and for Pep Guardiola his biggest ever loss as a coach.
Bayern also had Brazilian Rafinha sent off for slapping Henrikh Mkhitaryan in stoppage time.
The visitors took a 21st minute lead when Mkhitaryan slotted home after some good play, the Armenian making up for a string of missed chances in the 3-2 aggregate defeat against Real on Tuesday.
The midfielder, who apologised to his team mates and fans for his midweek lapses, kept his cool after Marco Reus sent him through with a fine pass.
Bayern, who face Real in the Champions League last four, were further hampered when goalkeeper Manuel Neuer was taken off at halftime with a calf muscle injury, making way for third-choice Lukas Raeder.
The 20-year-old's league debut got off to a nightmare start after 49 minutes when Mkhitaryan launched a quick break and Reus tapped in with the keeper out of position.
Raeder could do nothing, however, when Jonas Hofmann broke free to rifle in Dortmund's third in the 56th minute as the 71,000-crowd in the Allianz Arena fell silent.
Bayern tried desperately to hit back but they rarely got past a solid Dortmund defence and were reduced to long-range efforts which sailed wide.
With the title sewn up and in the Champions League last four, Bayern face second division Kaiserslautern in the semi-finals of the German Cup next week and are still on track to repeat their unprecedented trophy treble of last season.
Dortmund, in second place, kept their three-point lead over Schalke 04, who beat Eintracht Frankfurt 2-0 on Friday, with four games left.
At the other end of the table former Bundesliga champions VfB Stuttgart conceded an 89th minute goal to draw 1-1 at Borussia Moenchengladbach and remain deep in the relegation battle.
Midfielder Daniel Didavi, who was only picked to play at the last minute, slotted in from close range after 12 minutes to give Stuttgart the lead.
The visitors were far more aggressive than Gladbach and hit the post on 87 minutes through Ibrahima Traore's fierce free kick. But two minutes later they let their guard down and Juan Arango headed the equaliser.
Stuttgart, champions in 2007, are on 28 points, one above Hamburg SV who lost 2-1 at Hanover 96 courtesy of a late winner from Didier Ya Konan to remain in the relegation playoff spot.
Gladbach dropped to fifth with VfL Wolfsburg making the most of their draw to crush Nuremberg 4-1 and leapfrog into fourth place a point above, and in contention for a spot in the Champions League next season.
Goals from Croats Ivan Perisic and Ivica Olic cancelled out Nuremberg's early lead. Junior Malanda and Perisic added two more late in the game.
Werder Bremen also joined the relegation fray when they lost 3-0 at Mainz 05 to drop to 12th on 33 points, five ahead of Hamburg.
Freiburg moved up to 32 points after beating bottom-placed Eintracht Braunschweig 2-0 with an own goal and a second deflected effort to boost their own chances of staying up.
- Sports & Recreation
- Henrikh Mkhitaryan
- Pep Guardiola
- Marco Reus