La Roja hit the front in the contest courtesy of Dani Olmo in the second period, before a 89th-minute equaliser from Florian Wirtz meant that the Stuttgart crowd were treated to an additional 30 minutes.
With the game hurtling towards penalty kicks, Olmo turned provider in the 119th minute, finding fellow substitute Mikel Merino in the box, with the Real Sociedad midfielder heading his country into the final four.
Luis de la Fuente's side will now face either Portugal or France for the honour of taking part in the Euro 2024 final, as Spain's quest for a fourth European crown continues.
For all the hype around a new era of talent, Die Mannschaft have crashed out of their own tournament at the quarter-final stage, with plenty of issues for Julian Nagelsmann to solve ahead of September's international break.
HIGHLIGHTS
1st min: Nico Williams creates space infield and plays a ball into the feet of Morata, whose first-time pass is into the path of Pedri, but the youngster's tame effort rolls straight to the grateful hands of Neuer.
21st min: Joshua Kimmich delivers a beautiful floated ball into the box, where Kai Havertz rises higher than anyone else, but the Arsenal attacker is unable to get any significant power on his header.
35th min: Long ball is controlled by Havertz, who evades the attentions of Robin Le Normand and gets off a shot, which is straight at Simon who saves easily.
HALF TIME: SPAIN 0-0 GERMANY
47th min: Lamine Yamal feeds the ball into Havertz who has Jonathan Tah pinned - the Arsenal man turns well to produce an effort but his shot blazes over the bar.
52nd min: GOAL! SPAIN 1-0 GERMANY (OLMO)
An opener for Spain! Fabian Ruiz passes to Yamal on the right flank, and the Barcelona man dribbles into the box and plays a pass back to Olmo, who produces a calm first-time finish into bottom-left corner.
76th min: Wirtz gets around Marc Cucurella and plays a low cross into the box. Havertz gets on the end of the effort with a lunging attempt but the ball crashes off the post and away from danger.
83rd min: Another really good chance for Havertz. The German striker takes advantage of some poor Spanish play and sees Simon off his line, but former Chelsea man's long-range chipped effort goes agonisingly over the bar.
89th min: GOAL! SPAIN 1-1 GERMANY (WIRTZ)
Maximilian Mittelstadt swings a hopeful delivery into the box and Kimmich keeps the ball in play at the back post, finding the feet of an unmarked Wirtz, who fires the tournament hosts level with just minutes to go.
END OF NORMAL TIME: SPAIN 1-1 GERMANY
119th min: GOAL! SPAIN 2-1 GERMANY (MERINO)
Cucurella drives with the ball and plays it out to Olmo on the left flank, and the RB Leipzig attacker swings a delivery onto the head of Merino, who guides his effort into the near corner, with Neuer a spectator.
END OF EXTRA TIME: SPAIN 2-1 GERMANY
MAN OF THE MATCH - DANI OLMO
Due to Pedri's injury in the opening eight minutes, Olmo found himself on the Stuttgart pitch earlier than expected, however that did not stop the Spaniard from having a positive effect on proceedings throughout.
The 26-year-old produced a composed finish to give La Roja the lead during the second period of normal time, allowing Yamal to pick up his third assist of the tournament.
Olmo then turned into the playmaker in extra time, supplying the delivery as Merino fired Spain to a semi-final tie with either France or Portugal.
STANDOUT MOMENT
Although the last-gasp equaliser from Bayer Leverkusen's Wirtz deserves an honourable mention, the standout moment of the match has to be when Spain sealed their spot in the semi-finals of Euro 2024.
A fringe player for La Roja during his tournament, Merino fired his way into the limelight for the 2012 European champions with a lovely effort to beat Neuer in net.
BEST STATS
MATCH STATS
Possession: Spain 48%-52% Germany
Shots: Spain 18-23 Germany
Shots on target: Spain 6-5 Germany
Corners: Spain 1-5 Germany
Fouls: Spain 17-22
LINEUPS
SPAIN (4-3-3): Simon; Carvajal, Le Normand (Fernandez 45'), Laporte, Cucurella; Rodri, Pedri (Olmo 8'), Ruiz (Joselu 102'); Williams (Merino 80'), Yamal (Torres 63'), Morata (Oyarzabal 80')
GERMANY (4-2-3-1): Neuer; Kimmich, Rudiger, Tah (Muller 80'), Raum (Mittelstadt 57'); Can (Andrich 45'), Kroos; Musiala, Gundogan (Fullkrug 57'), Sane (Wirtz 45'); Havertz (Anton 91')