Real went into the game knowing they couldn't top Champions League Group H but appeared set to make a real statement regardless with two early goals.
Borja Mayoral grabbed his first goal in Europe's top competition with less than 10 minutes on the clock after good work from Cristiano Ronaldo.
Ronaldo picked out Isco, who failed to control the delivery but the ball fell to Mayoral who had a simple finish to give Los Blancos the lead.
The hosts doubled their lead soon after as Ronaldo produced an exceptional finish from the edge of the area to become the first player to score in every Champions League group game.
It seemed as if Los Blancos would record a routine win but Dortmund grabbed a lifeline in the latter stages of the first half when Pierre-Emerick Aubameyang headed home an exquisite cross from Marcel Schmelzer.
Aubameyang levelled matters soon after the break after being played in by Shinji Kagawa.
The Gabon striker, and reported Real target, saw his initial effort saved but expertly chipped the ball over Keylor Navas from the rebound.
Dortmund were denied a point after failing to clear in the final 10 minutes as the ball came to Lucas and he poked home, although Real thoroughly deserved the win and Ronaldo had what appeared to be a perfectly legitimate goal ruled out moments earlier.
Real will go into the draw for the first knockout stage as the group runners-up, while Dortmund enter the Europa League after finishing third.