Midfielder Xavi scored a fine individual goal to earn Spain an unconvincing 1-0 win over United States in their final Euro 2008 warmup on Wednesday.
Spain dominated for long spells but found it difficult to break down a well-organised American defence.
The home team showed more urgency as the second half progressed and hit the woodwork twice before Xavi dribbled his way through a crowd of players to score the only goal with 12 minutes to go.
The victory extended Spain's unbeaten run to 16 games.
"We suffered a lot in the first half but put them under more pressure in the second and found more spaces," Xavi told Spanish national television.
Coach Luis Aragones had expressed his annoyance at the soft goal conceded against Peru in last Saturday's 2-1 friendly win but stood by his back four of Sergio Ramos, Carlos Marchena, Carles Puyol and Joan Capdevila.
Andres Iniesta's stomach upset gave Villarreal's Santi Cazorla a place in the starting line up on the right of midfield.
Arsenal midfielder Cesc Fabregas also started as Aragones reverted back to his 4-1-4-1 formation due to the bruised thigh that kept striker David Villa on the sidelines.
Fernando Torres shook off an ankle strain to play the lone striker role, but the home side were restricted to a Xavi header and a Torres snapshot in a disappointing first half.
The side were whistled off the pitch in a damp, half-filled stadium, and Aragones shuffled his pack.
Marcos Senna replaced Xabi Alonso in the holding role, and the Primera Liga's top scorer last season Daniel Guiza came on for Torres.
Real Mallorca's Fernando Navarro won his first cap at left back, just after visiting striker Eddie Johnson had unsettled the Spain defence again, nipping in front of Marchena to head wide.
After 63 minutes Xavi's freekick came back off the crossbar, and soon after their most fluid passing move found Senna breaking into the area on the right, but the Brazilian-born midfielder's shot struck the base of the near post.
With time running out, Xavi found space with a clever turn and took on four defenders on the edge of the area before finishing past the advancing keeper.
Spain begin their campaign in Group D against Russia on June 10, before taking on Sweden and holders Greece.