ROSTOV-ON-DON, Russia — Jan Vertonghen started Belgium's comeback with a wild, looping header and Nacer Chadli capped it by finishing off a 10-second, end-to-end attack in the final moments.
It added up to a 3-2 victory over Japan on Monday that gave the Belgians a spot in the World Cup quarterfinals for the second straight tournament.
Trailing 2-0, Vertonghen scored with a header in the 69th minute that appeared to be a cross but somehow dropped in under the bar. Substitute Marouane Fellaini headed in another from Eden Hazard's cross in the 74th.
Chadli, who came on as a substitute in the 65th, decided it with virtually the last kick of the game in the fourth minute of injury time.
Belgium goalkeeper Thibault Courtois grabbed a corner kick and rolled the ball to Kevin De Bruyne, who dribbled to the top of the centre circle and passed to Thomas Meunier on the right. Meunier one-timed the ball across the area and Romelu Lukaku let it roll by for Chadli to tap in with his left foot from 7 yards.
Belgium is the first team to overturn a two-goal deficit in a World Cup knockout match since West Germany beat England in extra time at the 1970 tournament. The last team do it in regulation was when Portugal beat North Korea in the 1966 quarterfinals.
"It's a test of character. It's a test of the team," Belgium coach Roberto Martinez said. "You have to see how the substitutes react, how the whole team reacts."
Belgium will next face five-time champion Brazil in the quarterfinals on Friday in Kazan.
Japan led through early second-half goals by Genki Haraguchi and Takashi Inui, but they couldn't hold on.
"When we were up 2-0, I really wanted to score another goal and we did have opportunities," Japan coach Akira Nishino said. "We were to some extent controlling the game, but Belgium upped their game when they had to."
What was expected to be a mismatch ended up being a classic, partly because of Martinez's decisions to send on Fellaini and Chadli as substitutes in the 65th minute.
"In football, sometimes you want to be perfect," Martinez said. "In the World Cup and especially in the knockout stage, it's about getting through."
Belgium, which narrowly avoided joining Germany, Argentina, Spain and Portugal as big-name eliminations, won all three of its group matches and scored a tournament-leading nine goals at that stage.
Japan narrowly scraped through, advancing ahead of Senegal because it had fewer yellow cards.
The Japanese have now lost in the round of 16 three times without ever reaching the quarterfinals.
"It wasn't the players," Nishino said. "Maybe it was me who lost control of the game."
With the score even, Japan goalkeeper Eiji Kawashima dived backward to tip an 85th-minute header from Lukaku over the bar. Courtois then prevented an own-goal from midfielder Axel Witsel in the 90th and later palmed away Japan substitute Keisuke Honda's long-range free kick.
"When you play against Brazil you have to accept that they are the best team in the competition. Coutinho, Neymar (are) players who can decide the game in one second," Martinez said, looking ahead to the quarterfinals. "Against Brazil, I think we can enjoy it from the first minute. When you're a little boy, you dream of facing Brazil in the World Cup."
Belgium extended its unbeaten run to 22 games.
The Red Devils have not been beaten since a 2-0 loss to Spain in a friendly in September 2016. The last in a competitive match was in the game before that: a 3-1 loss to Wales in the quarterfinals of the 2016 European Championship.
Belgium has scored 74 goals during its unbeaten run, netting in every game except a 0-0 draw against European champion Portugal in a friendly last month.
Four Japanese players fell on their knees in despair after the final whistle. Hiroki Sakai and Gen Shoji were in tears.
This story has been corrected to show that player's surname is Chadli, not Chaldi.
Follow Jerome Pugmire on Twitter at https://twitter.com/jeromepugmire
More AP World Cup coverage: https://apnews.com/tag/WorldCup