Croatia crushed England's World Cup hopes in July. By beating Spain in a thriller on Thursday, the Croats have given Gareth Southgate's squad a chance to advance to the final phase of the inaugural UEFA Nations League.
Tin Jedvaj scored his second goal three minutes into stoppage time to earn Croatia a 3-2 victory and a first win in a competitive match since beating England in the World Cup semifinals.
Spain remained atop League A, Group 4 with six points. England and Croatia have four points each ahead of their head-to-head meeting at Wembley Stadium on Sunday in the last match.
A win for either England or Croatia will assure qualifying for the Final Four in June along with the other three group winners. Spain would go through if England and Croatia draw. The bottom team will be relegated to League B.
"We wanted to win this and to have the last match at Wembley to decide the group winner," Croatia coach Zlatko Dalic said. "Let's go and enjoy our football now. We are very motivated for that one."
While Croatia beat former world champion Spain, England eased to a 3-0 win over the United States in a friendly marking the farewell appearance of Wayne Rooney.
Elsewhere in the Nations League, Belgium beat Iceland 2-0 to stay on course to reach the finals. In the lower leagues, Bosnia and Herzegovina earned promotion to League A, and Finland earned promotion to League B.
In other friendlies, Germany routed Russia 3-0, the Czech Republic edged Poland 1-0, Ireland and Northern Ireland played to a 0-0 draw, and Israel thrashed Guatemala 7-0.
Croatia's win avenged a 6-0 loss, its worst ever, to Spain in September.
The World Cup finalists pressed Spain in its area late and Jedvaj pounced after goalkeeper David de Gea pushed the ball into his path. The Bayer Leverkusen defender had earlier made it 2-1 to the hosts when he was left unmarked to head in a cross by Luka Modric for his first international goal.
Spain twice rallied to equalize, first through Dani Ceballos canceling out Andrej Kramaric's opener and then via a penalty by Sergio Ramos.
Luis Enrique's lineup was pressing for a late goal when Croatia produced one last push that paid off with Jedvaj's second score.
"Croatia got that little bit of fortune when both teams were desperately trying to win this match right at the end," Luis Enrique said.
Rooney bids farewell
Making his 120th and last appearance for England, the 33-year-old Rooney was denied a perfect farewell by Brad Guzan when the US goalkeeper dived to stop his shot in stoppage time.
Recalled after two years out of the England squad, the D.C. United forward sparked the biggest cheers of the night when he went on as a 58th-minute substitute against the country he now calls home.
England's goals came from Jesse Lingard, Trent Alexander-Arnold and Callum Wilson.
Belgians on course
Michy Batshuayi, replacing the injured Romelu Lukaku in attack, scored twice as Belgium beat Iceland for a third victory in the Nations League.
A draw against Switzerland on Sunday would be enough for Belgium to reach the finals. It has nine points from three games in Group 2 of League A, three ahead of Switzerland. Iceland had already been relegated to League B before the match.
France and Portugal are also favored to reach the finals from their groups in League A.