Germany lost their lead and a place in the final to Spain as a result, as the Spaniards came out 2-1 victors in their semi-final clash.
The Germans had led through Renat Dadashov's tap-in after 11 minutes, which they held onto through the break.
Jordi Mboula missed a penalty that looked to be crucial but Abel Ruiz and Brahim Díaz turned it around late on to secure a final clash with Portugal.
Dadashov opens the scoring
Germany started as the more positive side and were almost rewarded when Dadashov sent a dipping and swerving shot narrowly over the bar from 25 yards. Ignacio Peña was struggling to reach his effort, which clipped the roof of the net on the way over.
However, Dadashov and his side would not be kept quiet for long. A quick free-kick from skipper, Atakan Akkaynak let Kai Havertz slide in down the right hand side unmarked. As Spain tried to regroup they couldn't prevent the cross from coming in and, as a result, they failed to clear at the back post. Dadashov picked up the loose ball and fired home.
Germany could have another in the passage of play that followed, although Havertz's shot was well-saved. From there Spain began to force a way back into the game as Mboula tricked his way past Jan-Niklas Beste before picking out Ruiz in the middle. He, somehow, managed to head over from just two yards out before the break.
Spain dominate the second half as they secured final spot
Spain ended the first half on a high and continued to press on after the restart. Mboula and Díaz were looking extremely dangerous and gave Germany's defence a headache that wouldn't go away for the 20 minutes following the break. Mboula flashed a cross along the goal-line but no-one was there to capitalise.
Ruiz and Diaz then combined to put the latter through on goal, only for a Jan-Christoph Bartels save to keep his close-range effort out. Germany threatened through Arne Maier and Havertz once again, though they posed little threat to Pena's goal. This proved to be mere momentary respite for the Germans.
Mboula's persistence then paid off as he rounded Bartels and tried to cut back from the oncoming midfield. Mika Hanraths stuck out a hand and Bartosz Frankowski showed no hesitation in pointing straight to the spot. Mboula took the resulting penalty but saw it cannon off the post and out to safety.
Germany were given several reprieves and looked like they would make it through to full-time, only for Spain to finally take a guilt-edge opportunity. Iván Martín marched down the left and picked out the perfect pass to find Ruiz in the middle, and he made no mistake to finish from close range.
If the game looked set to end as a Germany win then as the clock ticked down to penalties, Spain found the winner. Bartels made an excellent save from Ruiz but Diaz picked the ball up and fired through the unlucky goalkeeper's legs to seal a late win and book their place in the semi-finals. His day went from bad to worse when his late red card for bringing down Mboula signalled the end of the match.