The world and European champions overcame a turgid start and a spirited Irish outfit to seal a 2-0 win at Yankees Stadium ahead of this Sunday's Confederations Cup opener
Goals from substitutes Roberto Soldado and Juan Mata ensured Vicente del Bosque's side the victory, but they needed to overcome a determined Irish outfit to seal the win after a sluggish start to proceedings on the East Coast.
With the reigning world and European champions opening their Confederations Cup campaign in four days' time, the onus was on La Roja to perform admirably against the Irish ahead of the tournament, and the opening exchanges proved to be a distinctly slow affair.
Andres Iniesta fired a shot narrowly over the bar after a brilliant attacking phase in the early stages, but even though Del Bosque's side were typically dominating the possession count, they lacked the potency to trouble David Forde in the Ireland goal.
Nevertheless, the Boys in Green displayed plenty of fight to frustrate their more esteemed opponents - a far cry from last summer's capitulation at Euro 2012, and could've even taken the lead. Gerard Pique's indecision on the ball was punished by Sammon, who fired agonisingly wide when put one on one against Victor Valdes, in the half's best chance.
Spain, however, recovered from their poor opening, as Ireland began to open up. Pique's header had earlier been cleared off the line by Paul McShane, before a neat pass from Pedro in towards David Villa was intercepted at the last moment by the Hull City defender.
Giovanni Trapattoni's men were beginning to ride their luck, and were fortunate to not fall behind. Xavi teed up Pedro, who expertly turned away from his marker before firing a thundering shot off the underside of the crossbar, before David Silva struck hopelessly over the bar from the rebound as Ireland breathed a sigh of relief.
The second half proved to be an equally dogged affair, as Ireland continued to frustrate their opponents. The flurry of substitutions just before the hour allowed the world champions to add a new dimension to their attack, and it almost paid dividends as Jesus Navas tested Forde, before Pique's shot was thwarted by the goalkeeper.
Ireland's resistance was to be broken, as they finally folded. Darren O'Dea's poor clearance was picked up by Alvaro Arbeloa in an advanced position, before substitute Soldado struck cleanly past the impressive Forde to hand La Roja the lead. It could've been two seconds later, had Jordi Alba not struck narrowly wide.
The visitors had a goal chalked off for offside, in controversial circumstances. From a corner, which was helped on into the path of Simon Cox, in an offside position, before the ball was poked home by Sean St Ledger, sending the sizeable Irish contingent inside the stadium into raptures which soon was dashed by the referee's interjection.
Spain rallied from that scare, and finished strongly. Santi Cazorla saw a dipping effort from distance tipped over by substitute Darren Randolph, with Sergio Ramos heading narrowly over the bar from the resulting corner. Juan Mata wrapped up the game with a finely worked second goal, with a delightful chip over the goalkeeper on the back of a fine assist from Santi Cazorla.
Spain take on Uruguay in their Confederations Cup Group B opener on Sunday at the Arena Pernambucano in Recife, as attention turns towards the tournament in Brazil.