The European champions were stunned by a 2-1 Group C loss in Zilina on Thursday, but Diego Costa ended his international goal drought as they secured a comfortable win at Stade Josy Barthel to go second behind Slovakia.
Coach Vicente del Bosque dropped captain Iker Casillas after his costly mistake against Slovakia, with David de Gea replacing him in goal in the youngest starting line-up during the former Real Madrid coach's six-year tenure.
David Silva put Spain in front and Paco Alcacer's third goal in as many competitive games for his country three minutes before half-time put the visitors in command.
Brazil-born striker Costa then scored his first goal for Spain since turning his back on his country of birth, before Juan Bernat completed the scoring on his international debut two minutes from time.
Slovakia have a three-point lead over Spain and Ukraine after they maintained their perfect start with a 3-1 win away to Belarus, who have just one point to their name.
Marek Hamsik put the visitors in front after 65 minutes at the Borisov Arena, but Belarus were level 11 minutes from time courtesy of Timofey Kalachev's strike.
The group leaders were not to be denied, though, as Napoli midfielder Hamsik restored their advantage four minutes later and Stanislav Sestak made sure of the points with a third goal in stoppage time.
Serhiy Sydorchuk scored the only goal of the game as Ukraine beat Macedonia to make it two group victories in a row, with Andriy Yarmolenko also missing a penalty for the home side at Arena Lviv.
Austria move to the top of Group G courtesy of a 1-0 home victory over Montenegro, as Russia were held by Moldova in Moscow.
A solitary goal from Rubin Okotie after 24 minutes was enough to move Marcel Koller's side to the summit, as Montenegro suffered their first defeat in the group.
Russia will consider it two points dropped after they slipped up at the recently opened Otkrytie Arena, where Alexandru Epureanu's header 15 minutes from time cancelled out Artem Dzyuba's penalty just a minute earlier.
Sweden occupy third spot after they ran out 2-0 winners over Liechtenstein at the Friends Arena, with Erkan Zengin and Jimmy Durmaz on target.
Wayne Rooney scored the only goal of the game with a free-kick 17 minutes from time to ensure England beat 10-man Estonia in Tallinn to maintain their 100 per cent record in Group E.
Estonia captain Ragnar Klavan was sent off for a second bookable offence two minutes into the second half, but England were frustrated until Rooney curled home a set-piece to make it three wins out of three for Roy Hodgson's side.
Slovenia moved into second spot, three points behind England, by securing a 2-0 away win over Lithuania to leapfrog the hosts and end their perfect start to qualification.
Milivoje Novakovic did the damage, scoring both goals in the space of four first-half minutes and there was no way back for Lithuania - who also have six points.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.