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. Stanković 68'
for T. Jun 83'
|Lyon face anxious wait over Lacazette|
|Undermanned Lazio recall Perea|
|Ki wants South Korea to prove their superiority|
|Ghana´s Gyan wary of South Africa|
|Mashaba urges South Africa to attack|
|Benitez: Napoli deserved to win|
|Pacos de Ferreira 1 Benfica 0: Leaders fail from the spot|
|Serie A Review: Higuain at the double in controversial Napoli win, Udinese see off Empoli|
|I´m glad Rochdale haven´t made the news - Hughes|
|Getafe 2 Celta Vigo 1: Hosts come from behind for first win in 10|
|Real hit back at media reports over transfer dealings|
|Rochdale 1 Stoke City 4: Joy and angst for Bojan as Premier League side progress|
|Turkish Super Lig Review: Kuyt at the double in Fenerbahce win, Besiktas back on track|
|Senegal v Algeria: Morale is high, insists Gourcuff|
|Cassano leaves beleaguered Parma|
|Copa del Rey Preview: Atleti look to overturn Barca advantage, Espanyol wary|
|Atletico Madrid v Barcelona: Griezmann targets second-leg fightback|
|Sheffield United v Tottenham: Clough expects fired-up Spurs for second leg|
|Cape Verde 0 Zambia 0: Stalemate sends both sides out|
|Democratic Republic of Congo 1 Tunisia 1: Both teams qualify for quarter-finals|
|FA Cup fifth round: Middlesbrough handed Arsenal test|
|South Africa v Ghana: Must-win game for Mashaba´s men|
|Parma v Juventus: Serie A leaders strong favourites to reach semi-finals|
|Van Praag planning to stand for FIFA presidency|
|Inter snap up Brozovic|
|Van Persie unsure of long-term United future|
|Broken metatarsal rules El Shaarawy out for at least six weeks|
|FIFA: No disciplinary proceedings against Real|
|No Plan B if Guardiola goes - Rummenigge|
|Millwall take Hooiveld on loan|
|Chile v United States: Klinsmann has high hopes for young stars|
|Carver to lead Newcastle until end of season|
|Shenaishil taking positives from last-four exit|
|Neymar happy with life at Barca and Messi relationship|
|Lucas Silva ready for life at Real|
|Milan ´always with Inzaghi´ - Menez|
|Rodriguez living the dream at Real|
|Stielike expecting Australia in final|
|Mourinho not dwelling on Bradford defeat|
|Schweinsteiger under no pressure to extend Bayern contract|
|Herd heads to Wigan on loan|
|Inter defensive duo suffer hamstring tears|
|UAE coach Ali eyes Asian Cup final|
|Gattuso dreaming of managing Rangers|
|Fiorentina agree return of Gilardino on loan|
|Sakho hits back at critics|
|South Korea 2 Iraq 0: Kim books sixth Asian Cup final place|
|Sturridge could return against Chelsea|
|Zinnbauer backs Drobny as Hamburg first choice|
|Drogba targeting Chelsea stay|
|Postecoglou confident Australia squad can progress|
|UEFA does not have the courage to run against me - Blatter|
|Foster: Anichebe unplayable|
|Australia v UAE: Japan´s absence a boon for Asian Cup hosts|
|Milan v Lazio: Injury-hit visitors aiming for back-to-back wins|
|Trezeguet confirms retirement|
|No ´major problems´ with Nicolas Frey´s head wound|
|Strootman injury not "serious" - Garcia|
|No Paraguay, USA for retiring Riquelme|
|Saint-Etienne did not try to play football - Blanc|
|Primeira Liga Review: Sporting move within one point of Porto|
|La Liga Review: Parejo downs Sevilla, Resino starts with a point|
|Serie A Review: Juve go seven points clear as Roma draw again|
|Ligue 1 Review: Paris Saint-Germain and Lyon make Marseille pay for slip-up|
|Burkina Faso coach puts AFCON exit down to bad luck|
|Saint-Etienne 0 Paris Saint-Germain 1: Ibrahimovic scores in repeat performance|
|Shenaishil optimistic despite Kasim absence|
|Walcott: Goal has been a long time coming|
|DR Congo v Tunisia: Leekens warns against complacency|
|Congo 2 Burkina Faso 1: Thievy helps send 2013 runners-up crashing out|
|Gabon 0 Equatorial Guinea 2: Balboa and Iban put hosts through|
|McCarthy and Distin on road to recovery|
|Gil has hit the ground running - Lambert|
|Eredivisie Review: Ajax and Feyenoord lose ground after dour draw, Eagles secure big win|
|Wenger confirms Gabriel move is imminent|
|Eto´o presented to Sampdoria fans|
|Cape Verde v Zambia: Victory a must for 2012 winners to avoid elimination|
|Brighton and Hove Albion 2 Arsenal 3: Walcott and Ozil among the goals for holders|
|Mancini upbeat despite ´cruel´ late defeat|
|Pogba revelling in rich vein of form|
|Aston Villa 2 Bournemouth 1: Gil helps under-fire Lambert breathe easy|
|Defour dismissed after Standard Liege banner taunt|
|Allardyce relieved with scrappy West Ham win|
|Sturridge ´happy man´ after return to Liverpool training|
|Inter 0 Torino 1: Moretti ends unbeaten run for top-four hopefuls|
|Juventus 2 Chievo 0: Pogba inspires victory as leaders march on|
|Bristol City 0 West Ham 1: Super sub Sakho sinks City|
|Hughes in talks over new Stoke deal|
|Delph signs new contract|
|Chelsea v Liverpool: Mourinho demands League Cup response|
|Football League Preview: Derby eye top two, Cambridge back to reality|
|Nani not giving up on Old Trafford career|
|Perth Glory 3 Melbourne Victory 3: Leaders stage two-goal late comeback|
|Neymar: Barca have no interest in Real results|
|Milan defender Mexes apologises for red card|
|South Korea v Iraq: Strange lead-up for Shenaishil´s men|
|Lazio´s Djordjevic thanks well-wishers ahead of ankle surgery|
|Iran´s Asian Cup appeal dismissed by AFC|
|Cech urges Chelsea to clean up FA Cup exit ´mess´|
|Henderson: Liverpool are up for the cup|
|Edimar wants ´normal´ ban for Real star Ronaldo|
|Pellegrini defends misfiring City strikers|
|Australia ready for UAE - Sainsbury|
|Blanc takes positives from past|
|Inzaghi promises ´something different´ at Milan|
|Mexes sorry for seeing red|
|La Liga Review: Wins for top three|
|Vitoria Guimaraes 2 Gil Vicente 2: Last-gasp penalty salvages point for hosts|