Belgium completed a remarkable revival as they came from the World Cup abyss and beat Japan to reach the quarter-finals.
Roberto Martinez's side were trailing 2-0 when he brought on Marouane Fellaini and Nacer Chadli in the 65th minute, and Fellaini scored the equaliser before Chadli netted a 94th-minute winner.
They now face Brazil in the last eight on Friday.
Japan looked on their way to a famous win in Rostov after Genki Haraguchi ran onto Gaku Shibasaki's long ball, which Jan Vertonghen should have cut out, to open the scoring.
Takashi Inui's 25-yard strike made it 2-0 and looked set to take the Asian side into their first quarter-final.
Belgium's Premier League stars - their golden generation - had put in a disappointing performance, and Martinez turned to the oft-ridiculed Fellaini and West Brom winger Chadli in his hour of need.
Their fortunes changed after that as Vertonghen scored a looping header to get them back into the game.
Fellaini then headed in Eden Hazard's cross to level before Chadli converted Thomas Meunier's pass to finish off a flowing move and help the Red Devils avoid being the latest victims of a World Cup of shocks.
Belgium are the first team to fight back from two goals down to win a World Cup knockout game since West Germany against England in 1970.
Belgium clearly have the players - Hazard, Kevin de Bruyne, Romelu Lukaku and Thibaut Courtois are some of the Premier League's undoubted stars. They are now unbeaten in 23 games, but there are always questions about whether they are tactically astute.
Martinez and his players will feel they have gone some way to answering those, and finding a real winning touch, having looked dead and buried after an hour.
Chelsea winger Hazard had hit the post in one of their few good chances in the opening 60 minutes.
But they ground their way back into the game - even though the goal to give them hope was a bit of a fluke. Inui booted the ball up into the air and Vertonghen's looping header flew over keeper Eiji Kawashima, who should have done better.
At 20 yards, it is the longest headed World Cup goal since those stats were first recorded in 1966.
And the winner was a real team effort. Goalkeeper Courtois rolled the ball to De Bruyne, who had been quiet for 90 minutes but exploded into life when his country needed him.
The Manchester City playmaker carried the ball 60 yards before feeding Meunier, his cross was stepped over by Lukaku, and Chadli was on hand to steer it home.
Lukaku had scored 17 goals in his previous 11 Belgium games but his decision to not shoot on this occasion might prove more crucial than any of those.
Can Belgium now win the World Cup?
Belgium will feel a huge amount of spirit building after this fightback - and also when they reflect on the fact their last defeat was Martinez's first game in charge, against Spain in September 2016.
Their past two tournaments - the 2014 World Cup and Euro 2016 - have both come to an end at the quarter-final stage. The Red Devils, who have never won a major tournament, will be desperate to go at least one step further this time - but there is one huge problem.
Their next game is against the favourites to win the tournament, five-time champions Brazil, on Friday in Kazan. The winner of that game faces either 1998 kings France or two-time winners Uruguay for a place in the final.
They will not need reminding that if they had lost to England in the final group game, instead of beating them, no World Cup winners would have stood between them and the final.
"Belgium had to dig deep from within and they did it so well," said BBC Radio 5 live's Chris Sutton. "Belgium are not going to have a harder game than this all tournament. They were in a real scrap."
So close... yet so far away for Japan
Japan have taken big gambles in the past few months and after an hour in Rostov, it looked like they were paying off in style.
First they sacked head coach Vahid Halilhodzic and replaced him with Akira Nishino two months before the tournament started.
And it looked as if the Blue Samurai were going to become only the third Asian nation - after South Korea in 2002 and North Korea in 1966 - to reach the World Cup quarter-finals when they deservedly took the lead.
Haraguchi kept his composure to shoot across Courtois and give them the lead and then the impressive Inui blasted in a long-range second to put them in control.
In truth, they did not have a host of chances - with only four shots on target - and all the momentum had deserted them by the time Chadli placed the ball past Kawashima with seconds remaining.
"Japan will regret the last two minutes because they threw everything forward and they were a little bit too open at the back," said BBC One pundit Jurgen Klinsmann, a former Germany international. "In the 94th minute, the players are tired and they are thinking about extra time, and that is when mistakes happen."
What they said - 'it was a tragedy'
Belgium boss Roberto Martinez: "You get pushed in games. Let's congratulate Japan, they played the perfect game. They were clinical on the counter and so solid. It was a test of character and you see the reaction of our subs coming on to win the game. It tells you everything about this group of players.
"No negatives today, it was about getting through. It is a day to be very proud of these players. Keep believing in Belgium. In the World Cup you want to be perfect but it's about getting through, it's about winning."
Japan coach Akira Nishino: "I am devastated. Yes we took the lead but we couldn't win. It might have been a very small difference but I felt there was nothing in it.
"Maybe it was my decisions as a coach or my tactics, and we couldn't keep up with Belgium, who upped their game.
"I don't want to admit it. I do feel that it was a tragedy but I have to accept the defeat as a fact."
Man of the match - Takashi Inui (Japan)
The ninth last-minute winner of this World Cup - match stats
Belgium are the first team to come from two or more goals down to win a World Cup knockout stage match within 90 minutes since Portugal beat DPR Korea in the 1966 quarter-final (0-3 down, 5-3 win).
Belgium have reached the World Cup quarter-finals in successive tournaments for the first time.
Belgium have never kept a clean sheet in their 12 World Cup knockout round matches, shipping 28 goals in total.
Japan have scored six goals at Russia 2018, their highest ever tally in a single World Cup tournament.
There were just four minutes and 16 seconds between Japan's two goals, and just four minutes and 30 seconds between Belgium's brace to level the scores.
There have now been nine 90th-minute winning goals in the 2018 World Cup. There were just 10 in the previous five tournaments combined.
Eden Hazard has been directly involved in 19 goals in his 18 games for Belgium under Roberto Martinez, scoring 10 and assisting nine.
Takashi Inui is only the third player to have scored multiple goals in a World Cup tournament for Japan, after Junichi Inamoto in 2002 (2) and Keisuke Honda in 2010 (2).
Both of Marouane Fellaini's World Cup goals for Belgium have been headers.
Nacer Chadli scored his first goal in 11 games for Belgium, his previous effort coming against Estonia in June 2017.