When Jesus Navas finally broke the deadlock after 88 minutes the overriding emotion was relief rather than joy after the holders flirted with a defeat that would have sent them tumbling out of the tournament.
On the positive side Spain proved the old adage that great teams can find a way to win when not playing at their best although as the minutes ticked away in the Group C clash they appeared caught between not losing and trying to win.
"We had a very tough game today and we got through it and the important thing even when you have a poor day is that you keep advancing in the tournament," Spain coach Vicente del Bosque told reporters.
"We didn't have that many options going forward tonight. Our first touch let us down at times and that robbed us of speed and intensity," said Del Bosque.
Croatia, who hardly got a kick in the opening 25 minutes, grew in stature and had several excellent chances after the break and a penalty claim when Sergio Busquets tugged at Vedran Corluka's shirt as a cross arced towards the defender's head.
Defeat was harsh on Slaven Bilic's side who produced a highly-disciplined performance which disrupted Spain's normal smooth passing patterns and ended with them employing three strikers as they sensed a chink in their opponents' armour.
They depart from the finals to start a new era with Bilic having already signed up to coach Lokomotiv Moscow.
"The game plan was to thwart Spain in the first half and have a go at them in the second," he said.
"It worked. We did everything right except score. We came here to go all the way and we failed because we lacked that tiny bit of luck that makes all the difference."
At times a nervous hush descended over the 38,794 fans inside the spectacular arena as the arithmetic of Group C was calculated over and over again.
While Spain knew a draw was enough to take them through to the last eight, they would have surrendered top spot in the group to Italy but for substitute Navas's late strike.
News of Italy leading against Ireland meant Croatia had to gamble, and they did, sending on Nikica Jelavic and Eduardo in the second half to join Mario Mandzukic up front.
Impressive as they were in the 4-0 hammering of a hapless Ireland side, the group phase has not seen Spain at their best with a 1-1 draw against Italy to start with and then a stuttering performance against Croatia.
Tellingly, it was substitutes Cesc Fabregas and Navas who combined with Andres Iniesta to break Croatia's resistance with Fernando Torres, who scored twice against Ireland, cutting a frustrated figure before being replaced on the hour.
Whoever the Spaniards play in the quarter-finals, whether it be France, England or co-hosts Ukraine from Group D, their opponents will take heart from Spain's sometimes panicky display against Croatia.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.