Spain completed their preparations for the Confederations Cup late on Tuesday with a 2-0 friendly defeat of the Republic of Ireland in New York.
The world and European champions won thanks to late goals from super-subs Roberto Soldado and Juan Mata.
Soldado broke the deadlock in the 69th minute with a powerful drive, after being set up by defender Alvaro Arbeloa.
Mata sealed the won two minutes from time by making it 2-0 with a left-foot shot, after being play through by Santi Cazorla.
Spain started the match with veteran David Villa leading the attack but the Barcelona man, who is in poor form, looked sluggish and short on confidence and was replaced by the livelier Soldado.
The Valencia striker said: “I am delighted to have scored, it was an important goal...They defended well, it was not easy for us to break them down.” Another Spanish substitute who caught the eye was Iker Casillas, who made three important saves after coming on for Victor Valdes.
Manager Vicente del Bosque will have to choose between Casillas -- who has hardly played since December because of a feud with coach Jose Mourinho at Real Madrid -- and Valdes of Barcelona for the Confederations Cup.
Del Bosque said: “We have prepared well for the tournament with these two matches (the first was a 2—1 defeat of Haiti in Miami on June 8).
“All the players are looking keen and lively. We have suffered no injuries at all. For these reasons we are looking forward to going to Brazil.” Spain has been placed in Group B at the Confederations Cup, along with Uruguay, Nigeria and Tahiti. They will play their first game Sunday against Uruguay in Recife.