Jesus Navas scored a dramatic late winner as Spain produced a nervy and unconvincing performance to qualify for the quarter-finals of Euro 2012.
The Seville winger walked in Andres Iniesta's clever pass two minutes from time to break Croatia hearts and ensure the champions top Group C.
"Spain taking Fernando Torres off with half an hour left was a bit of a risk for the manager but it paid off because the substitute Jesus Navas scored the goal. There was a gap in the Croatian defence for the first time and I think Iniesta and Navas were both onside. But Spain weren't brilliant, and if I was in the England squad, I wouldn't be worried watching that."
Spain had come within a single goal of leaving the tournament but ultimately it was Croatia who missed out.
The world champions could face England, France or Ukraine in the last eight.
The landscape of the group might have been so different had Croatia scored the goal they had threatened to for long periods of the second half, however.
On a night of tension and frustration in Gdansk, Slaven Bilic's men stretched their more celebrated opponents time and again with Luka Modric tormenting the Spanish midfield with a vibrant, menacing performance.
The Tottenham Hotspur midfielder created the best chance of the match for Croatia on the hour mark, finding Ivan Rakitic from a scintillating cross delivered with the outside of his right boot which the Seville midfielder could only head directly at Spain goalkeeper Ilker Casillas.
Spain march on, however, now unbeaten in 17 competitive matches. But this was a performance that epitomised their faltering progress here: style but no substance, beauty but no brawn, panache but no penetration.
Much of the talk before the game had centred on Italy's fear that Spain and Croatia would contrive a 2-2 draw - a result that would have ensured both teams qualified for the quarter-finals at the Azzurri's expense. But at no stage did either side look capable of mustering two goals.
Bilic, in his last match as Croatia coach, had sent his side out intent on showing discipline and total determination to resist the mesmerising quality of Spain's football.
And for much of the opening 45 minutes, Croatia were outpassed, if not outclassed. But they stood firm, with the twin towers of Vedran Corluka and Gordon Schildenfeld at the heart of the defence epitomising Croatia's spirit and refusal to yield.
They could not, though, prevent Xavi from gradually getting Spain moving. Fernando Torres saw a fierce low shot turned away by Stipe Pletikosa after 22 minutes before David Silva and Iniesta twice almost linked up to devastating effect.
But for all their possession, Bilic's plan to stifle Spain was working and as the half wore on mistakes began to creep into the defending champions' normally flawless passing game.
Croatia were quick to pounce on the scraps, testing Casillas from Daniel Pranjic's low shot. There were vehement protests when the tireless Mario Mandzukic burst clear of Ramos and Pique, only for the Real Madrid defender to clatter into the Croatia striker on the right of the penalty area.
The referee waved away Croatia's penalty claims with Corluka booked for his protests.
News of an Italian goal shortly before half-time in Posnan changed things. Not only did Croatia now know they could no longer settle for a draw but now Spain's hopes of defending their trophy would, unthinkably, end if they conceded without reply.
Croatia were noticeably more progressive, competing for the ball in midfield and committing men forward in greater numbers. Modric skipped away from Spain's midfield trio from one such attack on the hour mark, to spark a move more fluid and threatening than anything they had produced until then.
The Tottenham playmaker evaded the attention of Jordi Alba and then Ramos, before picking out the unmarked Rakitic with a delightfully weighted cross that the Sevilla midfielder headed straight at Casillas from six yards. If Spanish hearts were in mouths then, the drama was to continue.
Bilic introduced Everton striker Nikica Jelavic and Borussia Dortmund's Ivan Perisic as Croatia pushed again and the pair linked up immediately only for the final pass to run astray. Spain were on the back foot now, prompting head coach Vincente Del Bosque to introduce Jesus Navas and former Arsenal midfielder Cesc Fabregas.
It was a decision that would alter the course of the game. Fabregas might have had his third goal of the tournament shortly after coming on and although substitute Ivan Perisic thumped a fierce low volley that Casillas turned away, Spain were looking increasingly dangerous as the game became stretched.
Sergio Busquets should have put Spain after a fluid counter-attack, while Fabregas freed Iniesta down the left of the penalty area only for Pletikosa to turn the ball away.
The Barcelona midfielders were at the heart of everything now as Croatia finally began to tire.
With three minutes remaining Spain finally found space. Again Fabregas was at the heart of things, scooping a delightful through-ball to Iniesta who brought the ball down on his chest, beat the off-side trap and squared to Navas who walked the ball towards goal, thumping it into the net from a yard out with a shot that spoke of Spain's frustration.
Croatia's players collapsed on the turf. For Spain the emotion was relief.
Sorry, we were unable to load match stats, please try again.
Live Text Commentary
Full Time The referee signals the end of the game.90:00 +3:54
Nikica Jelavic concedes a free kick for a foul on Garcia Sergio Ramos. Iker Casillas restarts play with the free kick.90:00 +3:21
Sergio Busquets concedes a free kick for a foul on Darijo Srna. Gordon Schildenfeld restarts play with the free kick.90:00 +3:18 Booking
Booking Ivan Rakitic is given a yellow card.90:00 +0:45
The official flags Alvaro Negredo offside. Stipe Pletikosa takes the direct free kick.90:00 +0:14
Direct free kick taken by Gerard Pique.90:00 +0:14 Booking
Booking The referee books Nikica Jelavic for unsporting behaviour.90:00 +0:03
Nikica Jelavic is penalised for handball and concedes a free kick.89:06
Iker Casillas takes the free kick.89:06 Booking
Booking Mario Mandzukic booked.89:06
Free kick awarded for an unfair challenge on Alvaro Arbeloa by Mario Mandzukic.88:29 Substitution
Substitution Alvaro Negredo is brought on as a substitute for Hernandez Xavi.87:05
Assist on the goal came from Andres Iniesta.87:05 Goal scored
Goal! - Gonzalez Jesus Navas - Croatia 0 - 1 Spain Goal scored by Gonzalez Jesus Navas from close range high into the middle of the goal. Croatia 0-1 Spain.85:24
Corner taken right-footed by Ivan Rakitic, Vedran Corluka produces a header from deep inside the six-yard box that clears the crossbar.85:16
A cross is delivered by Ivan Strinic, Alvaro Arbeloa gets a block in.84:20
Gonzalez Jesus Navas takes a shot. Save by Stipe Pletikosa.83:26
Inswinging corner taken from the left by-line by Hernandez Xavi, Da Silva Eduardo makes a clearance.83:13
Andres Iniesta takes a shot. Save by Stipe Pletikosa.80:08 Substitution
Substitution Da Silva Eduardo joins the action as a substitute, replacing Ognjen Vukojevic.
Inswinging corner taken from the left by-line by Ivan Rakitic, Iker Casillas makes a save.78:31
Darijo Srna sends in a cross, Alvaro Arbeloa makes a clearance.78:13
Ivan Perisic has a volleyed shot. Save by Iker Casillas.77:25
Corner taken right-footed by Hernandez Xavi from the left by-line, Ivan Strinic makes a clearance.77:07
Francesc Fabregas takes a shot. Blocked by Darijo Srna.74:32
Foul by Hernandez Xavi on Luka Modric, free kick awarded. Luka Modric takes the direct free kick.73:30
Hernandez Xavi decides to take the corner short.72:13 Substitution
Substitution David Silva goes off and Francesc Fabregas comes on.71:47
Corner taken right-footed by Hernandez Xavi from the right by-line, clearance by Mario Mandzukic.70:59
The ball is delivered by Gonzalez Jesus Navas, Ivan Strinic gets a block in.68:59
Close range effort by Ivan Perisic goes wide of the left-hand post.68:32
Ivan Perisic crosses the ball, clearance made by Ramos Jordi Alba.67:58
Xabi Alonso sends in a cross, David Silva concedes a free kick for a foul on Vedran Corluka. Direct free kick taken by Stipe Pletikosa.67:27
Corner taken short by Hernandez Xavi.67:21
Sergio Busquets crosses the ball, Gordon Schildenfeld manages to make a clearance.66:39
Outswinging corner taken by Hernandez Xavi from the right by-line.66:32
Gonzalez Jesus Navas produces a cross, Gordon Schildenfeld manages to make a clearance.65:01
Outswinging corner taken right-footed by Hernandez Xavi from the right by-line, Headed effort from deep inside the penalty area by Garcia Sergio Ramos goes harmlessly over the crossbar.65:01 Substitution
Substitution Nikica Jelavic joins the action as a substitute, replacing Domagoj Vida.65:01 Substitution
Substitution Ivan Perisic joins the action as a substitute, replacing Danijel Pranjic.61:43
Andres Iniesta gives away a free kick for an unfair challenge on Domagoj Vida. Domagoj Vida takes the free kick.60:47
Foul by Ivan Rakitic on Andres Iniesta, free kick awarded. Ramos Jordi Alba restarts play with the free kick.59:47
Vedran Corluka takes the direct free kick.59:47 Substitution
Substitution Gonzalez Jesus Navas joins the action as a substitute, replacing Fernando Torres.59:47
Free kick awarded for an unfair challenge on Gordon Schildenfeld by Fernando Torres.59:37
Fernando Torres takes a shot. Blocked by Domagoj Vida.59:13
Outswinging corner taken by Hernandez Xavi, clearance made by Vedran Corluka.59:02
David Silva takes a shot. Gordon Schildenfeld gets a block in.58:10
The ball is swung over by Luka Modric, Ivan Rakitic takes a shot. Iker Casillas makes a save.56:40
Alvaro Arbeloa gives away a free kick for an unfair challenge on Mario Mandzukic. The free kick is delivered right-footed by Ivan Rakitic from left wing, Xabi Alonso makes a clearance.54:42
Handball by Darijo Srna. Iker Casillas restarts play with the free kick.53:10 Booking
Booking Ivan Strinic goes into the book for unsporting behaviour.51:08
Gordon Schildenfeld fouled by David Silva, the ref awards a free kick. Stipe Pletikosa takes the direct free kick.50:25
Foul by Ramos Jordi Alba on Darijo Srna, free kick awarded. Stipe Pletikosa takes the free kick.48:29
Inswinging corner taken by Ivan Rakitic from the left by-line, Vedran Corluka gives away a free kick for an unfair challenge on Gerard Pique. Free kick taken by Iker Casillas.48:23
The ball is delivered by Ivan Strinic, blocked by David Silva.47:16
Alvaro Arbeloa challenges Ivan Strinic unfairly and gives away a free kick. Stipe Pletikosa takes the free kick.46:29
Foul by Danijel Pranjic on Alvaro Arbeloa, free kick awarded. Xabi Alonso restarts play with the free kick.45:39
Foul by Ivan Strinic on David Silva, free kick awarded. Direct free kick taken by Xabi Alonso.45:01
The second half begins.45:00 +2:06 Half time
Half Time The referee calls an end to the first half.45:00 +0:11
Outswinging corner taken right-footed by Hernandez Xavi, clearance by Mario Mandzukic.44:59
David Silva sends in a cross, Gordon Schildenfeld gets a block in.43:47
Garcia Sergio Ramos takes the direct free kick.43:47 Booking
Booking Darijo Srna receives a caution for unsporting behaviour.43:43
Sergio Busquets fouled by Darijo Srna, the ref awards a free kick.41:06
Corner taken right-footed by Hernandez Xavi, Vedran Corluka fouled by Garcia Sergio Ramos, the ref awards a free kick. Direct free kick taken by Stipe Pletikosa.39:04
Darijo Srna challenges Sergio Busquets unfairly and gives away a free kick. Garcia Sergio Ramos restarts play with the free kick.37:59
A cross is delivered by Mario Mandzukic.36:14
Danijel Pranjic is adjudged to have handled the ball. Alvaro Arbeloa restarts play with the free kick.34:49
Andres Iniesta takes a shot. Domagoj Vida gets a block in.33:42
Foul by Danijel Pranjic on Sergio Busquets, free kick awarded. Xabi Alonso restarts play with the free kick.32:01
David Silva takes a shot. Save made by Stipe Pletikosa.29:26
David Silva takes a shot. Save by Stipe Pletikosa.28:58
David Silva produces a volleyed left-footed shot from 12 yards. Save by Stipe Pletikosa.27:06
Darijo Srna takes a outswinging corner.27:06 Booking
Booking Caution for Vedran Corluka.25:05
Shot on goal by Mario Mandzukic from just inside the area clears the crossbar.24:30
Danijel Pranjic takes a shot. Save made by Iker Casillas.23:49
Gerard Pique takes a shot from a long way out clearing the bar.22:54
Garcia Sergio Ramos takes a shot. Stipe Pletikosa makes a save.22:11
Fernando Torres takes a shot. Stipe Pletikosa makes a save.21:08
Unfair challenge on Darijo Srna by Garcia Sergio Ramos results in a free kick. Ivan Rakitic crosses the ball from the free kick right-footed from right wing, clearance by Gerard Pique.19:48
Free kick awarded for an unfair challenge on David Silva by Ognjen Vukojevic. Free kick crossed by Hernandez Xavi, Vedran Corluka fouled by Fernando Torres, the ref awards a free kick. Stipe Pletikosa takes the direct free kick.19:06
Free kick awarded for an unfair challenge on Alvaro Arbeloa by Danijel Pranjic. Free kick taken by Xabi Alonso.18:14
Unfair challenge on Ramos Jordi Alba by Darijo Srna results in a free kick. Ramos Jordi Alba takes the direct free kick.15:41
Foul by Ivan Rakitic on Ramos Jordi Alba, free kick awarded. Andres Iniesta takes the free kick.14:02
Andres Iniesta challenges Darijo Srna unfairly and gives away a free kick. Ivan Rakitic takes the free kick.11:06
Andres Iniesta takes a shot. Save made by Stipe Pletikosa.10:15
Free kick awarded for an unfair challenge on Alvaro Arbeloa by Ivan Strinic. Direct free kick taken by Alvaro Arbeloa.9:29
Gerard Pique gives away a free kick for an unfair challenge on Mario Mandzukic. Free kick taken by Luka Modric.6:21
Gordon Schildenfeld fouled by Fernando Torres, the ref awards a free kick. Stipe Pletikosa takes the direct free kick.4:20
Free kick awarded for a foul by Mario Mandzukic on Gerard Pique. Gerard Pique restarts play with the free kick.3:28
Corner taken right-footed by Hernandez Xavi, Header on goal by Fernando Torres from inside the box goes harmlessly over the target.3:22
Ramos Jordi Alba sends in a cross, Gordon Schildenfeld makes a clearance.2:09
Free kick awarded for a foul by Andres Iniesta on Darijo Srna. Direct free kick taken by Ivan Rakitic.0:34
Free kick awarded for a foul by Mario Mandzukic on Sergio Busquets. Hernandez Xavi crosses the ball in from the free kick, Vedran Corluka makes a clearance.0:00
The match begins.
Live data and text provided by our data suppliers