Artem Dovbyk scored with virtually the last kick in extra-time to lift Ukraine past 10-man Sweden at Hampden to set up a Euro 2020 quarter-final with England.
Oleksandr Zinchenko sent Ukraine in front with a powerful drive but a deflected shot from Emil Forsberg levelled matters before half-time.
Sweden then 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 last minute winner from close-range.
Ukraine made it past the group phase with just three points and a negative goal difference while Sweden topped their section with seven points ahead of Spain.
But it is Andriy Shevchenko’s side that continue their amazing Euro fairytale with a date against England on 3 July.