"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.
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.
Their opening Group H fixture is against Switzerland in Durban on June 16.
(Writing by Mark Elkington in Madrid; Editing by Clare Fallon)