Marco Reus put Dortmund ahead late in the first half but David Alaba levelled with a deflected shot after a clever free-kick routine in injury time.
Robert Lewandowski headed in from Lucas Hernandez’s cross and set up Leroy Sane, who cut in to put them 3-1 up.
Erling Haaland rounded Manuel Neuer to give Dortmund hope in ‘Der Klassiker’ but they could not find an equaliser.
Lewandowski thought he had wrapped up the game in injury time with a strike that was deflected in by Dortmund’s English teenager Jude Bellingham but it was ruled out by the video assistant referee for offside.
The Poland forward also had another first-time effort for the European champions disallowed by the VAR.
The former Dortmund striker has scored 13 goals in his last eight league games against his former club. He is the all-time top Bundesliga goalscorer in ‘Der Klassiker’ with one for Dortmund and 17 for Bayern.
France winger Kingsley Coman also had a great chance for the Treble winners but smashed an effort off the post.
Bayern – who have won all bar two of their games in all competitions in 2020 – overtake RB Leipzig at the top of the Bundesliga.
This is the first time they have won more than five of their opening seven league fixtures since 2015-16.
Dortmund, who started the day level on points with Bayern, had chances to level with Reus volleying over and substitute Bellingham having a header saved.