INNSBRUCK (Reuters) -- Fernando Llorente headed a last-minute winner for Spain in a 3-2 victory over Saudi Arabia on Saturday as the European champion made a sluggish start to its preparations for the World Cup finals.
Spain should have felt at home in the Tivoli Neu stadium as it was where they beat Russia 4-1 to kick off their successful Euro 2008 campaign, but they fell behind to an Osama Hawsawi header in the 17th minute.
David Villa and Xabi Alonso scored either side of the break but a deflected shot from Mohammad Al-Sahlawi in the 75th minute put the Saudis level, before Llorente headed in at the end.
"This kind of thing happens sometimes but we have to be positive; we started a little lazily because we have had 15 days without playing and we found it hard to get into it," Spain coach Vicente del Bosque told Spanish state television.
"I'm not happy with everything. We are a little behind because we have these 15 days without playing but we have to remain optimistic."
Spain captain and goalkeeper Iker Casillas made his 103rd appearance to become the country's second most capped player.
Andres Iniesta, who looked lively on the left flank after recently recovering from a thigh injury, set up Spain's equaliser after defender Hawsawi had put the Saudis ahead.
The Barcelona midfielder cut back inside his marker and floated a cross for Villa to nod in unmarked from close range.
By then Spain were in charge and when a counter-attack broke down early in the second half, Alonso picked up the loose ball and drilled a low shot into the corner from outside the area.
Del Bosque gave Barca forward Pedro his first cap soon afterwards as he started making changes but the Saudis surprised Spain again, with Al-Sahlawi firing in a deflected shot.
Athletic Bilbao midfielder Javi Martinez won his first cap as a substitute just after the equaliser but it was his club team mate Llorente who spared Spain's blushes by heading in from a corner in the final minute.
Spain play South Korea in Innsbruck on Thursday, then go home for a game against Poland before flying to South Africa.
Their opening Group H fixture is against Switzerland in Durban on June 16.