Two goals from Karim Benzema had put the hosts in a commanding position, but they failed to kill off the game and were made to pay by the Bundesliga club
Substitute Marco Reus scored a dramatic equaliser with two minutes remaining as Borussia Dortmund drew 2-2 at Real Madrid to claim top spot in Champions League Group F.
Karim Benzema reached 50 Champions League goals with a close-range finish and a header either side of half time – a double that appeared to set Madrid on the path to victory.
But Pierre-Emerick Aubameyang struck with his 19th goal of the season to give the visitors hope before Benzema was denied a hat-trick when hero of the night Reus cleared his header off the line.
Cristiano Ronaldo hit the post in the closing stages but Madrid paid the price for their profligacy when Reus converted Aubameyang’s pass in the final moments.
Therefore it is Madrid who will have to face a group winner in the last 16, with Arsenal and Juventus among their potential opponents.
Andre Schurrle – starting as one of three Dortmund changes – shot over early on, but it was Madrid who made the stronger start and created a string of chances.
First, Ronaldo’s flick fed Benzema and his left-footed strike was well kept out by Roman Weidenfeller.
The Portugal international then set up James Rodriguez, who was denied by Weidenfeller from close-range before the Colombia international – in as one of two Madrid switches – tested the goalkeeper with another effort.