The Germans took a slight 2-1 advantage to Spain from the first leg, but things looked bleak after Cristiano Ronaldo scored twice within the first 15 minutes to swing the tie in favour of the hosts.
However, Arjen Robeen scored before the end of the first half, and with no other breakthroughs in 120 minutes, the game went to spot kicks.
Cristiano Ronaldo, Kaka and Sergio Ramos all failed to convert from the spot, leaving Bastian Schweinsteiger to hit the back of the net and send Bayern through.
Los Blancos boss Jose Mourinho blamed exhaustion for the defeat, claiming that Bayern had an easy weekend fixture against Werder Bremen.
“You have to stay balanced when you win and when you lose,” he told reporters, published by Sky Sports.
“The lads were fantastic, with an incredible mentality against a great team, against a team that last weekend were on holiday.
“We were maybe lacking a bit of freshness.
“It was a great, enormous game. We lost, we are sad and they are happy but that’s football,” he concluded.
The final at the Allianz Arena will take place on May 19th.
By Gareth McKnight