Meanwhile, Chelsea missed out on first place in their group to Juventus after conceding a late equalizer away to Zenit Saint Petersburg, while snow in northern Italy forced the postponement of Atalanta's decisive game against Villarreal.
Barcelona started the day in second place in Group E but had to win away to Bayern Munich to be sure of going through, otherwise they risked being overtaken by Benfica.
Xavi Hernandez's side were duly outclassed by an already-qualified Bayern who made it six wins out of six in the group, with Thomas Mueller's 34th-minute header just crossing the line before Ronald Araujo could clear.
The game was played behind closed doors at the Allianz Arena due to coronavirus restrictions in Bavaria, but that did not handicap Bayern, with Leroy Sane's powerful strike doubling their lead before the break and then Jamal Musiala making it 3-0 just after the hour.
- 'A new era' -
The Catalans were knocked out as Benfica beat Dynamo Kiev 2-0 in Lisbon, first-half goals by Roman Yaremchuk and Gilberto seeing them snatch second and a place in next Monday's draw for the last 16.
"We didn't compete. This is the Champions League but it is our reality and we have to face up to it," Xavi told Spanish media.
"We are starting a new era from zero. Our objective is the Champions League, not the Europa League."
Barcelona, who scored just twice in the group stage, had appeared in the knockout rounds of the Champions League in each of the last 17 seasons, last missing out in 2003-04 when they played in the UEFA Cup after coming sixth in La Liga the previous year.
They last went out of the Champions League in the group stage in 2000/01 when a team featuring a 20-year-old Xavi finished third in their section behind AC Milan and Leeds United.
The five-time European champions will now drop into the Europa League knockout-round play-offs in February.
- Juve pip Chelsea -
In contrast, Lille are through to the Champions League knockout stages for the first time in 15 years after beating Wolfsburg 3-1 in Germany to top Group G.
Burak Yilmaz gave Lille an early lead and Canadian striker Jonathan David made it 2-0 in the 72nd minute before Angel Gomes got their third. Renato Steffen got a late consolation.
Salzburg, Austrian champions in each of the last eight seasons, also progressed thanks to a 1-0 win over Sevilla, with Noah Okafor scoring the only goal before the Spaniards had Joan Jordan sent off.
It is the first time Salzburg have reached the knockout phase, while Sevilla join the likes of Barcelona and Borussia Dortmund in the Europa League -- that may suit them given they have won that trophy or its predecessor the UEFA Cup a record six times, all since 2006.
- Atalanta game postponed -
Last season's winners Chelsea had already qualified for the last 16 and were on course to top Group H as they led 3-2 away to Zenit going into injury time.
But then Magomed Ozdoev's stunning strike earned Zenit a 3-3 draw, allowing Juventus to snatch first place as Moise Kean's goal gave them a 1-0 win against Malmo.
Timo Werner had tapped in to put Chelsea ahead in the second minute, but Claudinho and Sardar Azmoun both scored before the break for Zenit.
Romelu Lukaku's first goal in nearly three months made it 2-2, and Werner's second of the night looked to have won it for Chelsea before Ozdoev struck.
"My analysis is very clear: our behaviour changes when we have a lead and this is something we never did and we should never do," said Chelsea manager Thomas Tuchel, whose team twice squandered an advantage to lose 3-2 at West Ham United last weekend.
Atalanta's game against Villarreal in Group F was postponed due to snow in Bergamo and was rescheduled for Thursday at 1800 GMT, with the Italians having to win to pip their visitors to second place in the group.
Group winners Manchester United drew 1-1 at home to Young Boys, with Mason Greenwood's acrobatic effort putting Ralf Rangnick's side ahead before Fabian Rieder equalised.
Standout matches today