The Spain victory saw Luis Enrique’s men secure a top-two finish in Group B.
And that confirmed Wales, currently third in Group E, as being guaranteed qualification for the play-offs by virtue of their efforts in the Nations League.
Rob Page’s side will now only not be in the play-offs if they win their pool for automatic Qatar 2022 qualification, which is still mathematically achievable with two games to go but appears unlikely.
Spain’s winner in Athens came via a Pablo Sarabia penalty in the 26th minute as they moved to the top of their group.
They are now a point clear of Sweden, who lost 2-0 away in Georgia, with Khvicha Kvaratskhelia notching twice in the second half.
The Republic of Ireland, whose bid to qualify for Qatar was already over, drew 0-0 with Portugal in Dublin. That took Portugal, who had Pepe sent off in the 81st minute, top of Group A – they are level on points with Serbia.
The other match in that pool was Luxembourg winning 3-1 at Azerbaijan.
There were braces for Leroy Sane and Thomas Muller as already-qualified Group J table-toppers Germany thrashed 10-man Liechtenstein 9-0 in Wolfsburg.
The visitors had Jens Hofer sent off in the ninth minute as he gave away a penalty that Ilkay Gundogan converted to open the scoring.
As well as four between Sane and Muller, the goals that followed included efforts from Marcos Reus and Ridle Baku, and two own goals, scored by Daniel Kaufmann and Maximilian Goppel.
North Macedonia moved into second place in the group with a 5-0 win at Armenia, Enis Bardhi registering a hat-trick that featured two penalties, replacing Romania, who were held 0-0 at home by Iceland.
In Group H, leaders Russia and second-placed Croatia each recorded big victories.
Russia won 6-0 at home against Cyprus, with Aleksandr Erokhin scoring twice, and Croatia won 7-1 away against Malta, Lovro Majer hitting a double and Ivan Perisic and Luka Modric also among the scorers.
Meanwhile, Slovakia and Slovenia battled out a 2-2 draw in Trnava.
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in