Zagreb - Spain passed up the chance to seal progress to the Nations League finals as they were beaten 3-2 by Croatia on Thursday, undone by a 93rd-minute winner from Tin Jedvaj.
Jedvaj's late strike leaves Group 4 wide open ahead of its final fixture between England and Croatia on Sunday. The victors will qualify, while Spain can still go through if the match at Wembley finishes in a draw.
Croatia were deserving winners in Zagreb, where Jedvaj scored twice - his first international goals - to snatch a memorable victory at the end of a pulsating contest.
Andrej Kramaric had put Croatia ahead but twice Spain came back, as Dani Ceballos' equaliser and Sergio Ramos' penalty looked to have earned them a point, before Jedvaj prodded in deep into injury-time.
Croatia will now head to London with a spring in their step while Spain are left to ponder back-to-back defeats under their new coach Luis Enrique, following their surprise loss by the same scoreline at home to England last month.
"I am obviously worried about the things we have to improve. But I think football today has not been fair to us," Enrique said.
Croatia coach Zlatko Dalic said: "We were rewarded for a magnificent match."
Spain are at least safe from relegation, which cannot be said of either England or Croatia, who could still both finish first or last come Sunday night. England will be relegated if they lose or are held to a score draw. Croatia will go down if they are beaten or draw 0-0.
"It shows it was a very difficult group," Luis Enrique added. "We still have a chance."
'Win or wait in hope'
Diario AS summed up Spain's position with the headline "Win or wait in hope" on Thursday. For Croatia, there was pride to be restored, after their 6-0 humiliation in Elche in September. "Six reasons to respond", read the front page of Croatian daily Sportske Novosti.
Eight of their 11 World Cup finalists started as Jedvaj, Nikola Kalinic and Kramaric replaced Ivan Strinic, Danijel Subasic and Mario Mandzukic, the latter two having since retired from international football.
Jordi Alba went straight into Spain's line-up while Athletic Bilbao's Inigo Martinez played alongside Ramos in central defence, with Nacho out injured.
Croatia dominated the opening exchanges but Spain began dictating possession as the half wore on, even if Isco's long-range shot shortly before half-time was their only real effort of note.
The game was more balanced and open after the restart and two goals arrived in as many minutes. First, Ramos and Sergi Roberto were pressed into a mistake, the latter's poor pass allowing Kramaric to sneak in and slot past De Gea with 53 minutes gone.
Spain performed better at the other end. Ceballos bundled in a quick equaliser and Aspas should have added another soon after but poked onto the crossbar.
Spain paid the price for that miss when Jedvaj headed in his first international goal after meeting Luka Modric's sumptuous cross at the back post.
Marcelo Brozovic should have put Croatia out of sight but spurned a one-on-one, his shot grazing De Gea on its way wide. This time Spain made them pay.
Sime Vrsaljko hacked substitute Alvaro Morata's header off the line before giving away a penalty, lowering his arm to meet a cross that was probably on its way behind. Ramos made no mistake from the spot.
Kramaric could have scored a late winner on the counter-attack but instead it was Jedvaj who struck the decisive blow three minutes into injury time.
Croatia kept the ball alive at the back post before Josip Brekalo fired at goal. De Gea might have done better than push the shot to his left where Jedvaj was perfectly placed.
Elsewhere in League A on Thursday, Michy Batshuayi scored a double in Brussels as Belgium saw off Iceland 2-0 to ensure they will only need a point from Sunday's game in Switzerland to reach the finals.
Bosnia and Herzegovina were promoted to League A following their goalless draw in Austria.