Plucky Macedonia gave Spain a tough test in their World Cup Group G qualifier in Skopje on Sunday but despite a superb goal from Stefan Ristovski the Spaniards still ran out 2-1 winners thanks to goals from David Silva and Diego Costa.
Spain quickly unlocked the Macedonian defence in the 15th minute, Andres Iniesta chipping a pass to Jordi Alba who pulled it back to Silva who turned and shot to open the scoring.
Diego Costa doubled their tally in the 27th minute, tapping in Isco's pin-point pass at the far post, but Ristovski shocked the Spaniards by reducing the deficit with a long run and thumping shot in the 66th minute to ignite a spark of hope for the home crowd.
Macedonia poured their energy into chasing another goal but it never came. The win means Spain remain top of Group G on goal difference ahead of Italy, who comfortably beat Liechtenstein 5-0 in Udine.
"We knew it was going to be a complicated game," defender Sergio Ramos told Spanish broadcaster TVE.
"The aim was to get the three points and we knew it was going to be difficult."
Spain somehow failed to convert a huge amount of possession into goals, despite coming in behind the Macedonian defence seemingly at will in the first half.
On the few occasions they lost the ball, the Spaniards won it back quickly and resumed their patient probing of the Macedonian defence but too often the final ball let them down.
Defending deep for much of the game, the Macedonians made a few forays forward on the counter-attack but they rarely managed to trouble David De Gea until Ristovski's frenetic charge from the halfway line ended with him firing into the top right corner.
Spain will host Italy in their next qualifying game while Macedonia, who are second from bottom of the group on three points, travel to third-placed Israel, who lost 3-0 to Albania.
For Ramos and his Real Madrid team mate Isco it was a perfect end to the season, having already won La Liga and the Champions League.
"It is true that I've finished the season very well. Confidence is key for any player," Isco told Teledeporte before thanking Spain coach Julen Lopetegui for picking him against Macedonia.
"Any of the players here are capable of starting but what matters is the team and this victory.
"The match against Italy will be an important one. We play at home at the Santiago Bernabeu which I hope will be a fortress," Isco said.
(Reporting by Philip O'Connor; Editing by Clare Fallon)