Fornals produced a fine near-post finish from the angle on 32 minutes after smart build-up play from Carlos Soler and Alvaro Morata.
Spain's high backline was put under severe pressure by the hosts and they were indebted to profligate finishing before Torres sealed the win in the 90th minute from a counter-attack.
The Athletic Bilbao stopper was just able to scramble back and stop Florian Loshaj's goalbound effort to keep Spain ahead.
It proved a crucial save as Torres went on to seal the win in the 90th minute from a counter-attack. After initially being flagged offside, the goal was awarded following a VAR check.
"It was a tough fought game right until the end," defender Aymeric Laporte said.
"Getting that second at the end was liberating in difficult conditions. The pitch was a tricky to play our football on.
"They've got their own weapons, and some quick forwards, but the important thing is we got the result. We need to win all our remaining games if we want to top the group."
Luis Enrique's side moved clear at the top of the group on 13 points from six games, four ahead of Sweden who have played two matches fewer.
Greece defeated Sweden 2-1 on Wednesday to move into third place on six points.