Olivier Giroud inspired Arsenal to complete a Champions League group stage comeback as his hat-trick at Olympiacos sealed their place in the last 16.
And manager Jose Mourinho received a slice of luck and another reprieve as his Chelsea side advanced to the knockout stages as Group G winners with a 2-0 victory over his former club Porto.
Having lost three of their previous five fixtures, the Gunners needed to win by two goals or more at the Karaiskakis Stadium or better the 3-2 defeat they suffered at home to the Greek champions in September.
With seven key first-team players missing through injury, manager Arsene Wenger recalled Theo Walcott after his recovery from a calf problem.
But it was Giroud who would produce the goods when it mattered as Arsenal made light work of a seemingly difficult task to seal a 3-0 win.
Arsenal become just the eighth side to advance through their group having taken three points or fewer from their opening four matches and Wenger will now be hoping to avoid the big names as they will come up against a group winner in the next round.
Wenger said: “I told you before that it would be the greatest escape. I must say I’m very proud of the team as we had to be right on the mental and tactical side.
“At 2-0 we had to push for a third goal, it was too dangerous to stay at 2-0.
“Maybe it is a lucky year for us in the Champions League, you never know.”
The first goal arrived when Mesut Ozil produced a sublime pass to set Aaron Ramsey away.
His near-post cross was met by the head of Giroud and the ball squeezed over the line as Olympiacos goalkeeper Roberto was unable to deal with it.
There was concern for Giroud at the start of the second half as he fell awkwardly on his ankle while helping out his defence.
But he soon got himself back on the pitch and doubled Arsenal’s lead.
Ozil again started everything with a clipped pass to Joel Campbell, with the former Olympiacos loanee controlling well under pressure before sliding a perfect pass into the path of Giroud for the France striker to sweep home.
Olympiacos had begun to set siege to Petr Cech’s goal when they were undone as referee Nicola Rizzoli pointed to the penalty spot after Nacho Monreal’s shot was blocked by the arm of the diving Omar Elabdellaoui.
Giroud duly despatched the resulting penalty to complete his hat-trick and send Arsenal into Monday’s draw for the first knock-out stage as they saw out the remainder of the contest with minimal fuss.
Chelsea had some good fortune when Porto goalkeeper Iker Casillas saved Diego Costa’s shot and the ball ricocheted in off Ivan Marcano for their opening goal at Stamford Bridge.
When Willian, Chelsea’s star player this season, doubled the lead seven minutes into the second half, Mourinho turned towards his son seated behind the dugout and punched the air in defiance.
Mourinho said: “The players were really committed to get a result, as much for their pride. They didn’t want to go to the Europa League.
“It was an important result for the players and the clubs.”