Ludogorets 2 Arsenal 3
A late Mesut Ozil strike saw Arsenal come from two goals behind to beat Ludogorets and secure their place in the last 16 of the Champions League.
With Group A rivals Paris St Germain beating Basle in Switzerland, a win for the Gunners would be enough to see them through with two games to spare - and Ozil popped up with three minutes remaining to complete a 3-2 win, which had looked improbable following a shaky start to proceedings at the Vasil Levski National Stadium in Sofia.
Ludogorets were two goals ahead inside the opening 15 minutes as Jonathan Cafu and Claudiu Keseru struck - but a first Champions League goal for Granit Xhaka and a header from Olivier Giroud before the break had Arsenal level and Ozil's late heroics mean they have qualified from the opening group stage for a 17th consecutive season.
Manager Arsene Wenger said on the eve of the game that it was Arsenal's "prime target" to top Group A in the hope of avoiding a tricky tie at the round of 16 stage - where the Gunners have been knocked out in the past six seasons.
And the Frenchman showed that intent by selecting arguably the strongest side at his disposal, despite the fact Arsenal face a crunch north London derby at home to Tottenham on Sunday.
Ozil, Laurent Koscielny and Alexis Sanchez were retained, although the latter was shifted onto the left flank to accommodate Giroud - making his first start of the season after scoring twice in Saturday's win at Sunderland.
Ludogorets, thrashed 6-0 at the Emirates Stadium a fortnight ago, changed their goalkeeper and centre-forward as Bulgarian striker Keseru came in having hit a hat-trick in their last league outing.
Ozil was the man who helped himself to three goals when these sides met last time out and he had a decent chance to open the scoring here, but his shot from Francis Coquelin's threaded ball was tame.
And it was the Bulgarian champions who took the lead as Cafu finished from close range after Arsenal had failed to clear a Wanderson free-kick into the middle of their penalty area.
The second came shortly afterwards as Kieran Gibbs was too easily beaten by Cafu down the right flank and Keseru converted his cross.
Arsenal responded well and, despite starting slowly, were back in the contest as Xhaka swept home Ozil's pass from the touchline.
While Ludogorets still posed a threat on the counter-attack, Arsenal were getting back to near their recent best and were level three minutes before the interval as Giroud headed home Aaron Ramsey's cross at the near post.
The second-half started evenly but without many chances for either side until Wanderson was played in behind just after the hour-mark, with the Brazilian not making the most of his opportunity and shooting weakly at David Ospina.
Mohamed Elneny came on late into the contest and played in Ozil, who showed great composure to round the goalkeeper and two defenders before slotting home and sealing Arsenal's spot in the last 16.
Here's a little extra sport. Watch the latest BallTalk for the best sports chat and analysis: Will 2016/17 be the season Arsenal finally win the Premier League back