Spain's Under-23 side completed their preparations for the Olympic Games with a hard-fought 1-0 victory over their Mexican counterparts on Wednesday night.
Luis Milla's troops were in need of a pick-me-up after Friday's shock 2-0 defeat by Senegal and they got one thanks to Javi Martinez, who headed home the only goal of the game in Cadiz.
The hosts began the brighter of the two sides, with Malaga's Isco drawing a decent save out of Mexico goalkeeper Jose de Jesus Corona just four minutes in.
Spain deservedly took the lead just 10 minutes later, with versatile Athletic Bilbao defender Martinez nodding home a corner from Adrian.
Mexico responded well to falling behind and Giovanni dos Santos and Javier Aquino threatened on occasion, but it took a fine stop from Corona to prevent the lively Martin Montoya from doubling their advantage, while Adrian missed a glorious opportunity after finding himself through on goal on 34 minutes.
The second half was nowhere near as entertaining as the first, despite the best efforts of the impressive Isco, and substitutes Alvaro Vazquez and Cesar Azpilicueta, with the latter calling Corona into action late on.
However, the game ultimately petered out and Spain held on quite comfortably to claim a morale-boosting win.
Mexico will play their final warm-up game against Japan at the City Ground on Saturday, with La Roja now set to kick off their campaign against the Asian nation in Glasgow on July 26.