"It wasn't easy. We weren't very crisp with our final passes, but we got the win and took an important step toward the World Cup," said Xavi.
Xavi wore the captain's armband after Spain coach Vicente del Bosque started Victor Valdes over regular skipper Iker Casillas.
Del Bosque also gave Swansea forward Miguel "Michu" Perez his first intentional start even though he had been a late replacement in the squad for the injured David Villa.