Gent beat Group H winners Zenit St Petersburg 2-1 at Ghelamco Arena to become the first Belgian club to get through to the knockout stages of the Champions League in 15 years.
Goals from Laurent Depoitre and Danijel Milicevic gave Gent a victory they did not ultimately need as Valencia lost at home to Lyon, while Artem Dzjuba scored for Zenit.
The Buffalos, who had lost just one of their past 10 matches in all competitions, knew they only needed to better Valencia's result to progress as runners-up to previously undefeated Zenit.
And Hein Vanhaezebrouck's side produced a composed display to deny Zenit what would have been a record sixth straight Champions League group stage victory.
The Belgians were ahead on 18 minutes when Depoitre scored his first goal in 10 games with a looping header after arriving to meet Moses Simon's left-wing cross at the near post.
Depoitre forced a good stop from Zenit keeper Yuri Lodygin as the home side looked to add to their lead before the break, with Nana Asare also failing to convert from point-blank range after another ball was whipped into the six-yard box.
Zenit manager Andre Villas-Boas opted to rest Brazilian forward Hulk, and it was not until midway through the second half that the Russians started to create some decent openings.
Eventually, they forced their way back into the match on 65 minutes when Dzjuba netted his sixth Champions League goal of the season after a scramble in the penalty area following a ballooned clearance by Gent captain Sven Kums.
As news of Lyon's 2-0 lead over Valencia started to filter through, the Gent fans were given a second goal to cheer when Milicevic fired home with 12 minutes left after more good work from Simon on the flank.