Roberto Soldado in the 69th minute and Juan Mata in the 88th scored for Spain, while goalkeeper Iker Casillas contributed two stellar saves in the second half.
Although Spain controlled the contest, played before 39,368 at the home of Major League Baseball's New York Yankees, they had nothing to show for it until the 69th minute.
A poor clearance by Darren O'Dea was picked up by Alvaro Arbeloa and substitute Soldado fired it past David Forde.
A dogged Ireland had chances to equalize, most impressively in the 81st minute when James McClean got through on the left and fired off a shot that Casillas deflected.
Sean St. Ledger found the net, but teammate Simon Cox was adjudged offside.
Mata sealed the victory in the 88th, collecting a pass from Santi Cazorla toward the left post and sliding a shot past substitute goalkeeper Darren Randolph.
Spain, who beat Haiti 2-1 in a friendly in Miami on Saturday, now head to Brazil for the Confederations Cup.
They play Uruguay Sunday in their first match of the competition in Recife.
Spain down Ireland 2-0 in friendly
Advertisement