The German side are second in Group F by nine points, one behind leader Real and three ahead of Shakhtar Donetsk, who will face them next week in their final group stage match, which will need a draw to guarantee them a top two place.
With Real Madrid already qualifying for the last 16, manager Carlo Ancelotti put several regular starters to rest and his side was dominated early on by the fledgling Leipzig squad.
The home side took the lead in the 13th minute when Josko Gvardiol scored on the rebound from a Thibaut Courtois save after a ball header from Andre Silva.
While the champions were still recovering from the first blow, Leipzig extended their lead five minutes later when David Raum attempted to pass into the penalty area but bounced a defender’s ball into the path of Christopher Nkunku, who reacted quickly and cleared the ball. shot into the goal. the crossbar.
Vinicius Jr brought Real back into the game just before half-time with a header that went just inside the left post.
But an attack from Timo Werner from close range to finish a quick counter-attack in the 81st minute put Leipzig ahead 3-1.
After a foul in the penalty area, Rodrygo scored from the penalty spot for Real’s second goal in added time.