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 its best performance under Luis Enrique despite losing Sergio Ramos and Sergio Canales to hamstring problems.
Manchester City's Torres added two more after the break before substitute Oyarzabal piled further pressure on Low, whose position will look increasingly perilous following this chastening defeat.
Morata could hardly believe his luck when he was allowed a free header at the far post from a deep corner by Fabian Ruiz, on as an early substitute for the injured Canales, to open the scoring.
Germany had struggled to get into the game and were fortunate not to be 2-0 down when Morata turned in Torres' cross only to be denied by a contentious offside call.
Manuel Neuer, who became Germany's most-capped goalkeeper as he made his 96th appearance, did superbly to turn Torres' strike around the post as Spain once more got in down the right.
However, he could do nothing to stop Torres smashing a rebound home from six yards after Dani Olmo's header had come back off the crossbar.
It was 3-0 to an utterly dominant Spain five minutes later as a corner from Koke found an unmarked red shirt, this time in the form of Rodri, who glanced a brilliant header out of Neuer's reach.
Ramos went off before the break after hurting his hamstring when sending a long pass forward, but his absence did little to shake Spain from their rhythm.
With Germany pushing for a route back into the match, La Roja sprung a counter-attack down the left and Jose Gaya squared for Torres to steady himself and smash home number four.
Torres secured his treble with 19 minutes to play, sweeping a low shot past a helpless Neuer as Spain once again cut the visiting defence to ribbons, and Oyarzabal was gifted an easy finish when Gaya prodded the ball into his path.