Zenit St Petersburg lost 4-1 at Austria Vienna but reached the UEFA Champions League knockout phase due to Porto's loss at Atletico Madrid.
The Russian side required victory to progress from Group G without relying on the outcome in the Spanish capital and Aleksandr Kerzhakov put them on course to do just that with the opener in the 35th minute.
However, Vienna scored three goals – two courtesy of Philipp Hosiner – within seven minutes either side of the break to leave Zenit facing an anxious wait before Roman Kienast added a fourth late on.
Porto were unable to recover a first-half deficit, resigning them to UEFA Europa League football and sending Zenit through to the Champions League round of 16 with only six points from six games.
Vienna, who were guaranteed to finish bottom before kick-off, celebrated their first win in Europe's elite competition, with Tomas Jun also on target.
The home side were without defender Lukas Rotpuller and midfielder Bernhard Luxbacher due to injury, while playmaker Danny missed out for Zenit.
That did not prevent the Russian heavyweights creating chances in an opening half hour they dominated.
Within 180 seconds, Hulk fired over the crossbar following a neat passing move. Domenico Criscito was then close to connecting with a Viktor Fayzulin cross, before Hulk created space for himself with some delightful footwork only to see his shot from the edge of the box blocked by Kaja Rogulj.
Zenit eventually broke the deadlock in the 35th minute. Kerzhakov's clever movement coupled with defender Manuel Ortlechner's untimely slip allowed the former to race on to Hulk's reverse throughball. Kerzhakov took it round goalkeeper Heinz Lindner and slotted home into the empty net.
Out of nothing, however, Vienna equalised on the stroke of half-time. Hosiner robbed Zenit of possession, played a superb one-two with Marko Stankovic and slotted the ball across goalkeeper Yuri Lodygin and into the bottom corner.
Within six minutes of the restart, Vienna were 3-1 up. First, following a very poor goal-kick from Lodygin, Markus Suttner controlled the ball sublimely and crossed to give Jun a tap-in.
Then Florian Mader's long-range strike was parried by Lodygin straight into the path of Hosiner, who thumped the ball home to complete his brace.
Zenit tried to respond as Konstantin Zyryanov went close from distance, Hulk forced Lindner into a smart save and Axel Witsel saw his powerful strike go narrowly over the crossbar.
But Vienna completed a 4-1 success in injury time, when the brilliant Hosiner crossed for substitute Kienast to fire home.
|16||P. Hosiner||44' 51'|
|Coach: N. Bjelica|
for T. Murg 60'
for M. Stankovic 68'
for T. Jun 83'
|Everton profited from ´harsh´ refereeing, claims Delaney|
|We will get much better, Guardiola warns rivals|
|Ibrahimovic turned down €100m China deal - Raiola|
|Everton 1 Crystal Palace 1: Benteke cancels out Lukaku opener|
|Rashford looking to emulate Ronaldo at Manchester United|
|Managers given bad name by Allardyce scandal - Moyes|
|Pagliara claims he lied to Telegraph over bungs|
|Dyche excited by Arsenal challenge|
|Mazzarri wary of unleashing Success until he is fully fit|
|Moyes stands by criticism of players|
|Guardiola marvels at amazing Ryder Cup experience|
|Mathieu and Deschamps ´exchange´ gives Mangala recall|
|Retirement threat just ´erratic´ Tevez being dramatic - Joorabchian|
|Dani Alves wants Champions League glory with Juventus|
|Guardiola: Football fans can enjoy Tottenham|
|Ranieri calls for consistency from Leicester|
|Low missing out on ´dream´ player in Castro - Tuchel|
|Mata: I never had problems with Mourinho|
|Conte wants failures to motivate Chelsea|
|Pochettino rules out ´impossible´ England switch|
|Emery pleased with Ben Arfa attitude|
|Gundogan returns for Germany after lengthy absence|
|Terry out again as Chelsea prepare for Hull|
|Hasselbaink refutes corruption allegations|
|Robben to start against Cologne, suggests Ancelotti|
|Prolific Callejon called into Spain squad|
|Hull City offer ´keeps changing´ - Phelan|
|Krueger: Black allegations do not directly affect Southampton|
|Wenger optimistic over Coquelin recovery|
|Hughes focused after Mourinho backing|
|Wenger open to England job|
|Klopp eyes retirement before 60|
|Wenger the pioneer battles on within his own legacy|
|Lukaku: I am not on Suarez´s level yet|
|Ibrahimovic is tremendous even if he does not score - Mourinho|
|CONCACAF Champions League Review: Olimpia, Honduras Progreso claim key wins|
|Astra expected hungover Roma - Spalletti|
|United fixture list a ´poisoned gift´ - Mourinho|
|Ronaldo back for ´stronger´ Portugal|
|Dembele can be next Drogba - Rodgers|
|Mourinho wanted Pogba at Chelsea, says Raiola|
|Puel pleased with ´good point´ in Israel|
|Mourinho not ´over the moon´ with United wins|
|Southampton investigating Eric Black allegations|
|Rodgers: Celtic would challenge at the top in England|
|Ibrahimovic expects more from United|
|Manchester United 1 Zorya 0: Ibrahimovic header earns Mourinho´s men narrow win|
|De Boer blasts Inter for lack of focus|
|Zarate reveals message to ill wife after goalscoring return|
|Raffael suffers fresh injury setback|
|Hapoel Be´er Sheva 0 Southampton 0: Saints´ winning run comes to an end|
|Sparta Prague 3 Inter 1: De Boer´s side humbled in Europa League again|
|Police to review corruption allegations after Telegraph sting|
|Brady hails Wenger as ´possibly the best ever´ Gunners boss|
|Yacob signs new West Brom deal|
|Guidolin prioritising Swansea improvement over his future|
|Sakho outburst has been dealt with – Klopp|
|Bilic sorry for Allardyce in ´very sad´ week for English football|
|Laporte saga nears conclusion as defender earns France call-up|
|Everton are exceeding expectations – Koeman|
|Wenger could be tempted by an international offer, says ex-assistant|
|No excuses for Liverpool this time, says Klopp|
|Rashford left out of England Under-21 squad|
|Boro must pick up where they left off - Karanka|
|Matuidi could still join Juventus, says Raiola|
|Pardew anticipates battle of the Belgians|
|Legia Warsaw to face Real Madrid behind closed doors|
|England job would be the pinnacle - Pardew|
|Wright sacked by Barnsley|
|Bilic defends West Ham team night out|
|Ramsey withdrawal was Arsenal´s call - Coleman|
|LMA demand ´immediate full disclosure´ of corruption evidence|
|´My answer would be a big fat no´ - Coleman rules out taking England job|
|Leeds dismiss Cellino sting as ´non-story´|
|Gabigol, Rashford and Sanches among Golden Boy nominees|
|Keane slams Arsenal: Half their players will have gloves on soon|
|´Special´ Man City draw a career highlight, says Gordon|
|Southgate admits England situation is ´not ideal´|
|England should have gone for O´Neill, says Shilton|
|PSG´s powers of recovery impress Cavani|
|Howe ´absolutely committed´ to Bournemouth amid England links|
|Man City proved character against Celtic, says Zabaleta|
|Walcott: Sanchez partnership bodes well for Arsenal´s season|
|MLS Review: DC, Impact on track for play-offs|
|CONCACAF Champions League Review: Tigres, Dallas left waiting|
|Central Sanchez pleases Wenger|
|Barca felt Messi absence - Busquets|
|Martino knew Messi would come out of retirement|
|Shilton never convinced by Allardyce|
|Degenek replaced by Giannou for Socceroos|
|Griezmann will still take penalties - Simeone|
|Simeone proud of ´one of the best´ wins|
|Godin suffers sprained ankle ligament|
|West Ham receive positive news over injured duo|
|Robson: Four wins for Southgate and he´s an England contender|
|Gunes rues Besiktas´ inability to see off Dynamo|
|Sarri: Late goals leave bitter taste|
|Borussia Monchengladbach were exceptional against Barcelona, feels Schubert|
|PSG must be patient, says Emery|
|Celtic are lucky to have Dembele - Rodgers|
|I´m completely focused on Arsenal, insists Wenger amid England talk|