Match ends, Sweden 1, Ukraine 2.
Artem Dovbyk scored in added time in extra time as Ukraine edged out 10-man Sweden at Hampden to set up a Euro 2020 quarter-final with England.
Oleksandr Zinchenko smashed Ukraine in front with a powerful drive but a deflected shot from Emil Forsberg levelled matters before half-time.
Sweden lost Marcus Danielson to a red card in extra time after a VAR check.
And, with penalties looming, Dovbyk - one of 12 substitutes used - headed a dramatic winner from close range.
Ukraine had crept through from the group phase with three points and a negative goal difference, while Sweden topped their section with seven points, ahead of Spain.
However, the match in Glasgow was an even contest throughout, with both sides out on their feet by the final whistle.
With so many changes in personnel and a sending off, there was no rhythm or shape in extra time.
The Swedes were twice temporarily down to nine men after head knocks and Ukraine replacement Artem Besedin lasted just 10 minutes before he was on the receiving end of Danielson's high challenge.
The Sweden defender, who got his foot to a dropping ball before catching his opponent, was initially booked but referee Daniele Orsato upgraded to red after reviewing the incident on the pitch-side monitor.
There was little in the way of goalmouth action after Danielson's 99th-minute dismissal until Zinchenko swung in a cross from the left and Dovbyk slid in to score his first international goal.
Change of shape benefits Ukraine
Ukraine coach Andriy Shevchenko switched to a back three, allowing Zinchenko to operate as a left wing-back, and his captain revelled in the role, setting up the winner and cracking in the opener on 27 minutes.
Andriy Yarmolenko found the Manchester City player with a cute outside-of-the-boot pass and Zinchenko thundered in an angled shot that Robin Olsen got a hand to but could not keep out.
Forsberg then enjoyed a slice of fortune as his deflected shot from 22 yards flew into the net just before the interval for his fourth goal of the tournament.
But the impressive midfielder's luck was out when he twice struck the woodwork in a lively second-half spell, with those shots following an effort from Ukraine's Serhiy Sydorchuk which clipped a post.
Ukraine goalkeeper Heorhiy Bushchan did well to push away a strike from Dejan Kulusevski and the same player was in behind in the 89th-minute but the ball would not sit for his weaker right foot, allowing defender Illya Zabarnyi to slide in and block.
- 2LustigSubstituted forKrafthat 83'minutes
- 24DanielsonBooked at 99mins
- 6AugustinssonSubstituted forBengtssonat 83'minutes
- 7LarssonSubstituted forClaessonat 97'minutes
- 20OlssonSubstituted forHelanderat 101'minutes
- 10ForsbergBooked at 85mins
- 21KulusevskiBooked at 69minsSubstituted forQuaisonat 97'minutes
- 11IsakSubstituted forBergat 97'minutes
- 5SydorchukSubstituted forBezusat 117'minutes
- 6StepanenkoSubstituted forMakarenkoat 95'minutes
- 10ShaparenkoSubstituted forMalinovskiyat 61'minutes
- 7YarmolenkoBooked at 79minsSubstituted forDovbykat 105'minutesBooked at 120mins
- 9YaremchukSubstituted forBesedinat 90'minutesSubstituted forTsygankovat 101'minutes
- Daniele Orsato
- Shots on Target
Second Half Extra Time ends, Sweden 1, Ukraine 2.
Attempt missed. Ruslan Malinovskiy (Ukraine) left footed shot from the left side of the box misses to the right. Assisted by Viktor Tsygankov.
Serhii Kryvtsov (Ukraine) wins a free kick in the defensive half.
Foul by Filip Helander (Sweden).
Artem Dovbyk (Ukraine) is shown the yellow card for excessive celebration.
Goal! Sweden 1, Ukraine 2. Artem Dovbyk (Ukraine) header from the centre of the box to the centre of the goal. Assisted by Oleksandr Zinchenko with a cross.
Substitution, Ukraine. Roman Bezus replaces Serhiy Sydorchuk.
Attempt missed. Ruslan Malinovskiy (Ukraine) left footed shot from the centre of the box is close, but misses to the left. Assisted by Artem Dovbyk.
Attempt blocked. Ruslan Malinovskiy (Ukraine) left footed shot from outside the box is blocked.
Ruslan Malinovskiy (Ukraine) wins a free kick in the attacking half.
Foul by Marcus Berg (Sweden).
Attempt missed. Oleksandr Karavaev (Ukraine) left footed shot from the right side of the box misses to the left. Assisted by Serhiy Sydorchuk.
Attempt missed. Artem Dovbyk (Ukraine) right footed shot from the centre of the box is too high. Assisted by Ruslan Malinovskiy with a through ball.
Offside, Sweden. Pierre Bengtsson tries a through ball, but Robin Quaison is caught offside.
Oleksandr Karavaev (Ukraine) wins a free kick on the right wing.
Foul by Albin Ekdal (Sweden).
Illia Zabarnyi (Ukraine) wins a free kick in the defensive half.
Foul by Robin Quaison (Sweden).
Foul by Artem Dovbyk (Ukraine).
- Starstruck: The one-night stand that has blockbuster consequences
- Advice from former Love Islanders: What do they wish they had known before entering the villa?