Pep Guardiola's German giants were 3-1 winners over CSKA Moscow in the icy cold Russian capital thanks to goals from Arjen Robben, Mario Gotze and Thomas Muller.
Muller converted a 65th-minute penalty to seal the win, three minutes after Keisuke Honda had given CSKA brief hope.
Bayern will advance from Group D alongside Manchester City who toiled for a 4-2 win at home against Viktoria Plzen, a team that almost pinched a first point of their campaign.
Sergio Aguero and Samir Nasri twice put City ahead, but Tomas Horava dragged Plzen level at half-time and Stanislav Tecl left all to play for at 2-2 when he struck low beyond Joe Hart in the 69th minute.
Alvaro Negredo, another expensive foreign import by the 2012 Premier League champions, gave Manuel Pellegrini's side the spoils with a 78th-minute winner, and Edin Dzeko headed a late fourth.
Vidal scored two penalties, sandwiching an equaliser from Olof Mellberg, and sealed his treble in the 63rd minute by heading in Paul Pogba's cross.
Defender Ramos was dismissed in the 26th minute, and 11 minutes later Gareth Bale gave Madrid the lead with a fine free-kick, only for the advantage to be almost instantly wiped out by Umut Bulut.
Alvaro Arbeloa and Angel Di Maria netted in the first 20 minutes of the second half, and Isco added a fourth goal for the hosts late on.
Chancel Mbemba and Massimo Bruno scored for Anderlecht, but Nemanja Matic, an Mbemba own goal, and Moreno Rodrigo's 90th-minute low finish earned three points for the Portuguese visitors.
Benfica moved level on points with Olympiacos in the battle for second place, after the Greek side lost 2-1 in Paris.
Kostas Manolas snatched an equaliser with 10 minutes remaining, but Edinson Cavani poked in a late winner for the Ligue 1 champions.
Manchester United were 5-0 winners away to Bayer Leverkusen to guarantee their Champions League campaign will continue into the new year, as Antonio Valencia, Jonny Evans, Chris Smalling, Nani and an Emir Spahic own goal made it a great night in Germany for David Moyes' men.
Leverkusen fell to third place in Group A, one point behind Shakhtar Donetsk who beat Real Sociedad 4-0 thanks to goals from Adriano, Alex Teixeira and Douglas Costa, who netted twice.
Shakhtar face United at Old Trafford in the final round of group games, with Leverkusen away to winless Sociedad.