Federico Valverde struck in the 92nd minute on Wednesday to give Real Madrid a 3-2 Champions League win at AEK Athens.
The hosts had led twice at the Allwyn Arena, only for Jude Bellingham and Kylian Mbappe to bring Jose Mourinho’s side level each time.
Madrid arrived in Athens with maximum points from three games, keen to avoid February’s play-off round after missing the top eight in both previous seasons.
Mourinho made five changes, with Eder Militao starting for the first time this season after surgery on a thigh injury.
Dumfries replaced Trent Alexander-Arnold, Camavinga came in for Aurelien Tchouameni, and Vinicius Junior was free to play.
Former Real striker Luka Jovic led AEK’s line against his old club, while AEK sought their first multi-goal game of this Champions League campaign.
A moment of silence for Tenerife player Jesus de Miguel preceded kick-off. AEK started brighter, with Mijat Gacinovic forcing Thibaut Courtois into a low save in the fifth minute, while Jovic’s hold-up play gave the hosts a platform.
Aboubakary Koita gave AEK the lead in the 12th minute. Jovic held the ball up and found him on the right of centre, and the forward shifted away from Marc Cucurella before driving a left-footed shot into the bottom corner.
Courtois kept Madrid in the match, denying Jovic with another sharp save in the 17th minute after clever work from Gacinovic, who drew five fouls before the 20-minute mark. Mbappe sent Madrid’s first real chance over the bar in the 21st minute.
Madrid slowly found a response. A Vinicius Junior goal was ruled out for an offside Jude Bellingham touch in the 28th minute, but four minutes later Bellingham flicked in Marc Cucurella’s cutback, his first Champions League goal of the season.
Vinicius Junior had another effort flagged offside in the 42nd minute after a Dumfries cross, and the sides went in level at 1-1.
Madrid pushed after the restart. Eder Militao tested Alberto Brignoli from distance, and Lazaros Rota blocked a Cucurella shot after a Mbappe drive, before a head clash between Eduardo Camavinga and Rota halted play in the 58th minute, with both players needing treatment.
The stoppage let AEK change, with Barnabas Varga and Razvan Marin on for Kaan Kairinen and Gacinovic. Mbappe curled a shot just wide, Cucurella was booked for fouling Varga, and Madrid replaced Bernardo Silva and Yan Diomande with Endrick and Federico Valverde.
Bellingham dragged a snapshot wide, and Stavros Pilios blocked a Mbappe effort, then AEK struck again in the 75th minute. Koita drove infield from the left and threaded a pass to the underlapping Pilios, who slid his finish under Courtois to make it 2-1.
Madrid hit back immediately. Bellingham slid a pass down the right for Dumfries, who caught Koita napping and squared for Mbappe to score from close range in the 78th minute. It was his sixth consecutive Champions League game with a goal, matching his best run.
Mourinho made more changes in the 81st minute, Brahim Diaz and Alvaro Carreras replacing Cucurella and Vinicius Junior. Then Endrick sent Mbappe through in the 86th minute, and the striker’s curler hit the crossbar after a Brignoli fingertip. Carlos Espi replaced Bellingham.
Valverde decided it in the 92nd minute. AEK had replaced Jovic with Oleksandr Zubkov and were within sight of a famous result, when Brahim Diaz found the Uruguayan, who unleashed an unstoppable right-footed strike from distance that arrowed into the right side of the goal.
Koita was sent off after the final whistle for persistent protests at the referee. Madrid kept their perfect record in the competition, reaching 12 points from four games after another comeback win, a result that moves Mourinho’s side closer to a top-eight finish.