Dortmund's triumph in the first leg of the semifinal also lined up the prospect of an all-German final at Wembley Stadium on May 25, following Bayern Munich's 4-0 rout of Barcelona on Tuesday. The second leg matches will be played next week.
Lewandowski opened the scoring in the eighth minute, only for Cristiano Ronaldo to equalize against the run of play two minutes before the interval.
But Lewandowski beat the offside trap to claim his second in the 50th, and the Poland striker completed his hat trick in stunning fashion five minutes later. He rounded off the scoring with a penalty in the 67th, after Xabi Alonso brought down Marco Reus.
"It was an outstanding game from my team," Dortmund coach Juergen Klopp said. "The third goal was worth every cent (broadcasters) ZDF and Sky give us."
Dortmund midfielder Ilkay Guendogan, playing on Madrid's name, which means royal in Spanish, said: "It was a royal evening for us."
The only unbeaten side remaining in the competition, Dortmund made it six wins from six at home and extended Madrid's run of six consecutive defeats in Germany.
"I could see there was one team on the pitch that was much better than the other. The better team definitely won," Madrid coach Jose Mourinho said after his worst result as a coach in the Champions League.
The hosts' preparations for the game looked to have been disrupted by news breaking the day before of attacking midfielder Mario Goetze's decision to join Bayern at the end of the season. There was no obvious fallout during the match, though.
"Today put everything in the shade. To take all that (background) and deliver that performance," Klopp said. "Without this atmosphere this game would not have been possible. One hundred percent."
His side almost claimed an early the lead when Reus ran at three defenders before forcing a save from Lopez. The rebound fell just beyond the lurking Lewandowski in front of the open goal.
Lewandowski took his chance a minute later, however, when Ilkay Guendogan sent Goetze free down the left, and the 20-year-old whipped in a dangerous cross that Lewandowski managed to reach ahead of Raphael Varane and Pepe.
The visitors' troubles in the face of Dortmund's pressing game were summed up when Alonso went back to collect the ball from his goalkeeper, only to put a long pass out over the sideline.
Ronaldo brought a smart save from Roman Weidenfeller with a free kick, before Guendogan shot over at the other end as the visitors resorted to last-ditch defending.
Lewandowski, Reus and Goetze again were striking terror through the heart of the Madrid defense, which was resorting to last-ditch tackles to avert the danger.
Dortmund's swashbuckling forays forward had the crowd on their feet, rising to the occasion as they sensed something special was happening.
Penalty appeals were waved away after Reus fell under Varane's challenge in the area, and the home fans had further ground for complaint when Gonzalo Higuain seized on Mats Hummels' weak back pass and rolled it across goal for Ronaldo to fire into an unguarded net.
It was his 12th goal of this season's campaign in Europe and his 50th in the Champions League overall.
The game was being played at such a frenetic pace after the break that both sides found it hard to complete passes.
However, Lewandowski ran onto Reus' defense-splitting pass before tucking the ball past Lopez, and he did even better five minutes later when he eluded Pepe by dragging the ball back and hammered the ball home from close range.
Only a fingertip save from Diego Lopez denied Guendogan from claiming Dortmund's fourth in the 62nd, but Lewandowski notched his fourth from the spot five minutes later.
"I also scored four goals," joked Klopp, who once played in Germany's second division. "1990 in Erfurt."
Lewandowski might have had a fifth late on, only to be denied by a flying save from Diego Lopez, before Varane missed the chance to pull one back in injury time.
Though Dortmund will be looking for only its second appearance in the final -- having won the competition in 1997 -- Mourinho refused to give up hope of Madrid reaching a 13th European Cup final.
"In football everything is possible," Mourinho said. "Anything can happen next week."