Artem Dovbyk netted a dramatic winner in stoppage time at the end of extra time as Ukraine squeezed past 10-man Sweden 2-1 at Hampden Park, to book a Euro 2020 quarter-final clash with England.
The final whistle was met with wild scenes of celebration as Ukraine reached the last eight of a major tournament for only the second time, after they made the quarters at the 2006 World Cup.
The two sides were level at 1-1 after 90 minutes following goals from Oleksandr Zinchenko and Sweden's in-form Emil Forsberg, but the tide changed when Sweden defender Marcus Danielson was sent off nine minutes into extra time.
Sweden looked resigned to taking the game to penalties, but Dovbyk had other ideas, meeting Zinchenko's cross in the 121st minute to settle the contest and send Ukraine into uncharted European Championship territory.
A small contingent of Ukraine supporters were at Hampden to witness their side's first-ever appearance in a European Championship knockout round, and they nearly got off to a dream start as Roman Yaremchuk was denied by a smart Robin Olsen save.
Sweden were causing problems in an entertaining opening too, but it was Ukraine who edged in front, with Manchester City's Zinchenko hammering home after 27 minutes having been picked out by a sumptuous Andriy Yarmolenko pass with the outside of his boot
Having fallen behind in the tournament for the first time, Sweden looked short of ideas and needed a slice of luck to get themselves back into the game, with Forsberg's speculative strike taking a huge deflection before finding the net just before halftime.
Forsberg, who has four goals in the tournament so far, one behind leading scorer Cristiano Ronaldo, then followed Ukraine's Serhiy Sydorchuk in hitting the woodwork after the break, not once but twice.
With neither side able to find a winner, extra time followed and Sweden's task was made all the more difficult as Danielson was sent off for a high and dangerous tackle on Artem Besedin, following a VAR review.
Both teams tired and another last-16 penalty shootout seemed inevitable, following the drama of world champions France's exit on Tuesday, but Ukraine had one final attack in them, with Dovbyk stealing the headlines.