(CNN) -- French side Lyon charged into the knockout stages of the European Champions League with a 7-1 rout of Dinamo Zagreb to go through in Group D behind all-conquering Real Madrid.
Lyon went into the final round of matches three points behind Ajax Amsterdam and needing to make up a goal difference of seven to reach the last 16.
Ajax were beaten 3-0 at home to Real, who made it six wins from six, while French international striker Bafetimbi Gomis inspired Lyon to their remarkable triumph with four goals in Croatia.
Remarkably, Dinamo had taken the lead on 40 minutes through 17-year-old Mateo Kovacic, although down to 10-men after the red card for Jerko Leko.
But Lyon were soon level as Gomis scored his first before halftime.
Maxime Gonalons made it 2-1 just after the break then three quickfire goals from Gomis and further strikes from Lisandro Lopez and Jimmy Briand completed the rout.
On his way Gomis scored the fastest hat-trick in the history of the Champions League, just seven minutes, beating the record of Mike Newell for Blackburn in 1995.
Meanwhile, Real were completing their 15th straight win by wrecking Ajax's hopes of progression.
Ahead of "El Clasico" against Barcelona at the weekend, they played an understrength side and youth product Jose Callejon put them ahead after 14 minutes before Argentine striker Gonzalo Higuain added the second just before the interval.
Callejon scored the third in injury time, his fourth Champions League goal of the season.
In Group B, CSKA Moscow left it late to go through after a 2-1 win at Inter Milan, who were already assured of topping the section.
Leonid Slutski's side were heading out of the competition with four minutes left on the clock after Esteban Cambiasso had equalized Seydou Doumbia's second-half opener for the visitors.
But Vasili Berezutski's scored with a dramatic late header, which combined with a goalless stalemate between Lille and Trabzonspor saw the Russian side go through.