Spain opened their Confederations Cup campaign with a narrow 2-1 win over Uruguay which the world and European champions dominated for long periods in Recife.
Pedro's deflected shot and a fine finish from Roberto Soldado put Spain 2-0 ahead before a late free-kick from Luis Suarez gave Vicente del Bosque's men some nervous moments towards the end.
Spain took the lead after 20 minutes when Pedro's shot from the edge of the area was deflected past Muslera by Diego Lugano. Soldado increased the lead shortly after when Fabregas played him in on the edge of the area and he took a touch before firing home.
With three minutes to go Suarez reduced the deficit when he curled a free-kick from the right just inside the near post and out of the stretch of the diving Iker Casillas.
Italy moved level on points with Brazil at the top of Confederations Cup Group A after beating Mexico 2-1 at the Maracana.
Andrea Pirlo, playing his 100th game for his country, put Italy ahead in the first half with a stunning free-kick before Javier Hernandez levelled from the spot.
Mario Balotelli put the Italians ahead again with 12 minutes left to seal a deserved victory.
Mexico came into the match on the back of eight draws from their last nine matches and for a large period they looked set to continue that trend, thanks in the main to goalkeeper Jose de Jesus Corona.
Italy dominated the majority of the match but the Mexican stopper was in impressive form to keep them at bay, with Balotelli in particular frustrated until his late winner.