Spain players celebrate a goal by David Villa during their victory over Saudi Arabia. ((Joe Klamar/AFP/Getty Images))

European champion Spain edged Saudi Arabia 3-2 in a World Cup warmup Saturday in Austria on an injury time goal by substitute Fernando Llorente.

Llorente headed home a score after keeper Walid Abdullah Ali misjudged a corner kick.

Slow and sloppy play had Spain trailing 1-0 after 16 minutes when Osama Hawsawi found the net with a header.

Spain rallied to lead 2-1 through a header from David Villa — his 37th goal for Spain — and a long-distance shot from Xabi Alonso.

Sultan Al-Numare leveled for Saudi Arabia in the 74th with a deflected shot that caught Spain goalkeeper Iker Casillas off balance.