Manchester City winger Ferran Torres scored his first career hat-trick as Spain inflicted Germany's heaviest competitive defeat and joined France in the four-team Nations League finals.
In a repeat of the Euro 2008 final, former Chelsea forward Alvaro Morata headed in Spain's first goal, before Torres volleyed home emphatically.
Rodri made it three with a guided header, and Torres slotted in a fourth before curling home the fifth.
Mikel Oyarzabal's tap-in made it 6-0.
Spain and France will be joined by either Belgium or Denmark from Group A2 and Italy, the Netherlands or Poland from Group A1.
Meanwhile Everton forward Richarlison was on the scoresheet as Brazil beat Uruguay, who had Manchester United striker Edinson Cavani sent off.
Cavai received a straight red card after a video assistant referee review following a challenge on Richarlison in the second half.
Juventus midfielder Arthur Melo opened the scoring before Richarlison headed in a second on the stroke of half-time.
Uruguay were without Luis Suarez after he tested positive for Covid-19.
Despite hitting the woodwork twice in the first half and Martin Caceres having a goal ruled out for offside in the latter stages, the hosts failed to record a shot on target.
Victory maintains Brazil's 100% winning record in the South American qualifiers for the Qatar 2022 World Cup.
Elsewhere Chelsea striker Olivier Giroud moved closer to Thierry Henry's goal-scoring record as France survived a late rally to relegate Sweden.
Giroud netted in each half to move to 44 goals, seven behind the Arsenal legend's mark.
A deflected Viktor Claesson shot put Sweden ahead but Giroud's double and a goal from full-back Benjamin Pavard turned things around.
Robin Quaison's goal gave Sweden some hope but Kingsley Coman sealed the win.
Sweden will now drop into League B.
World champions France had already qualified for one of the four Nations League finals berths next year but went behind when Claesson's long-range strike went in off Raphael Varane.
⏰ RESULTS ⏰— UEFA Nations League (@EURO2020) November 17, 2020
? Who impressed you?#NationsLeague