Polish hit-man Lewandowski became the first player in Champions League history to score four goals against Real to leave Dortmund well-placed to reach next month's final and set up the possibility of an all-German final with Bayern Munich.
Cristiano Ronaldo grabbed what could prove to be a crucial away goal for Real, but Lewandowski was the hero for Dortmund with a stunning individual performance.
Dortmund settled the better of the two sides and they went close to scoring after just seven minutes when Marco Reus picked the ball up and ran to the edge of the box before firing in a low shot which Diego Lopez did well to keep and Lewandowski was just unable to capitalise on the rebound as the ball went too wide and Sergio Ramos got back to block his shot.
The home side did make the breakthrough a minute later with Robert Lewandowski losing Pepe inside the six-yard box to sweep home Mario Gotze's inviting cross from the left and send the home fans into raptures.
Real were struggling to make any real impact in the early stages and it took them 24 minutes to have their first shot on target when Ronaldo fired in a trademark free-kick from fully 35 yards which Roman Weidenfeller did well to push away.
The game swung in Real's favour just before the break with Dortmund feeling they should have been awarded a penalty only for seconds later for the Spanish side to draw level.
Marco Reus went down in the box under pressure from Raphael Varane, but the home side's penalty appeals were waved away and the suffered a double blow as play switched straight down to the other end as Real equalised.
Mats Hummels made a mess of an attempted backpass to allow Gonzalo Higuain through on goal and he unselfishly crossed for the unmarked Ronaldo to slot the ball into the empty net.
Dortmund came flying out of the traps at the start of the second half and they restored their lead five minutes after the break as Reus's shot landed at the feet of Lewandowski inside the box and despite claims for offside from the Real defence the Pole poked home his shot from close-range.
Things got even better for Dortmund on 55 minutes as Lewandowski completed his hat-trick with a superb finish. Marcel Schmelzer's cross from the left found its way to Lewandowski inside the box and he showed great skill to drag the ball back past Pepe before smashing an unstoppable shot high into the net past Lopez.
Dortmund were in full flow and Ilkay Gundogan was denied a stunning goal by a superb fingertip save by Lopez after a fine run by the Dortmund midfielder past a couple of Real Madrid challenges.
The German side were awarded a penalty on 67 minutes when Reus was barged over in the box by Xabi Alonso and Lewandowski made no mistake from the spot as he drilled his shot straight down the middle.