Ronaldo's fine through ball just evaded Isco, but fell perfectly into the path of Mayoral and the 20-year-old kept his cool to chip the onrushing Roman Burki for his first Champions League goal.
By contrast, Ronaldo had his 114th in the competition moments later as he lined up a sumptuous strike from 25 yards.
However, the warning signs of a Dortmund recovery were in evidence as the first half wore on as Varane had to make last-ditch challenges to deny Aubameyang and Shinji Kagawa.
Aubameyang has spoken openly of his desire to play for Madrid one day and did his case of a dream move no harm with two classy finishes either side of half-time.
Once Varane limped off, Aubameyang was left free inside the box to plant a diving header inside the far corner two minutes before half-time.
And just four minutes after the break Dortmund were level as Aubameyang dinked a lovely finish over Keylor Navas after his initial effort had been saved by the Madrid goalkeeper for his fifth goal in his last four appearances against Real.
"He is great player and with his speed he is always a dangerous player," said Dortmund boss Peter Bosz. "I hope he stays a long time with us."
Ronaldo was wrongly denied his second of the night by the offside flag as he prodded home from close range.
But moments later Madrid did grab the winner when Vazquez's effort trundled past Burki, who was slow to react as the ball nestled in the bottom corner.
Dortmund should still have earned a share of the points, but Kagawa blasted a glorious chance over the bar as the German giants' run without a win in the Champions League or Bundesliga stretched to 11 games.
"The performances have to improve," admitted former Ajax coach Bosz, whose job is under serious threat.
"We started very badly, but after we showed how well we can play and the return of some injured players in December gives us hope for the future."