Spain came from behind to claim a 2-1 victory against Croatia in Geneva.
Croatia started brightly and went ahead when Pablo Ibanez put through his own net after 14 minutes.
Spain had handed a debut to Argentina-born left Mariano Pernia - who replaced injured Chelsea defender Asier Del Horno in their squad for the finals.
Pernia capped a dream start to his international career as he levelled matters just after the hour mark as his miscued free kick worked its way through a crowded penalty area and past Stipe Pletikosa.
The match looked destined for a draw, after Pletikosa redeemed himself by saving a Fernando Torres free kick after Sergio Ramos went down in the area.
However, Torres made amends with a fine winner in the final minute as he danced his way through the Croatian defence before firing home past Pletikosa..
Both teams have now finished their build-ups to the finals, as they prepare for the opening games next week.
Croatia kick-off their Group F programme against champions Brazil on Tuesday - while in Group H, Spain tackle Ukraine the following day.