Germany needed just a draw with Spain to qualify from their Nations League group, but they were resoundingly beaten in Seville.
Ferran Torres scored a hat-trick as Spain secured a place at next year's Nations League Finals with a 6-0 demolition of Germany on Tuesday.
Alvaro Morata, Rodri and Mikel Oyarzabal were also on the scoresheet in Seville as Joachim Low suffered the heaviest loss of his 14 years in charge.
Germany needed only a point to secure top spot in Group A4 but found themselves 3-0 down by half-time, Spain delivering their best performance under Luis Enrique despite losing Sergio Ramos and Sergio Canales to hamstring problems.