A 94th-minute winner by Nacer Chadli ended the World Cup dreams of Japan in heartbreaking fashion as Belgium pulled out a stunning fightback to win 3-2 on Monday.

After weathering a first-half Belgium storm, Japan opened the second period with two lightning strikes, Genki Haraguchi and Takashi Inui scoring goals that allowed the Samurai Blue to dream of an unlikely win over the world's No. 3 team -- and a first appearance in the quarterfinals.

But the star-studded Belgium team, who entered the game on a 22-game unbeaten run, struck back with goals from Jan Vertonghen and Marouane Fellaini, before the final dagger from Chadli sent Japan's players crumpling to the floor.

(Belgium's Kevin De Bruyne (R) comforts devastated Japan defender Gen Shoji at the final whistle)

"I guess the way we carried out the game plan shows our naivety," said Japan captain Makoto Hasebe. "It's difficult to put into words and it will take a bit of time to get our heads around this, but we gave the ball away cheaply and various mistakes led to us conceding."

When the hurt recedes, Japan will realize that they took part in one of the most entertaining games of the World Cup, a pulsating, end-to-end battle that featured the best of coach Akira Nishino's team in attack and defense.

Belgium's win sets up a tantalizing final-eight meeting with Brazil after the five-time champions beat Mexico 2-0 in Samara earlier Monday.

Japan opened with the positivity that has become a feature of Nishino's tenure and Thibaut Courtois almost gifted the Asian team a 44th-minute lead when a weak Gen Shoji shot was deflected by Yuya Osaka and the Belgium keeper let it trickle through his legs before pouncing on it.

Japan opened the scoring in the 48th minute when Haraguchi was put in an attacking position by Gaku Shibasaki and smashed the ball across Courtois and inside the left post.

(Genki Haraguchi celebrates Japan's opener)

Belgium almost leveled immediately when Eden Hazard thumped the ball against the post, but Japan stretched their lead four minutes after their first when Shinji Kagawa teed up Inui, who curled in with his right foot.

The European team's first goal came in the 69th minute when Vertonghen somehow managed to float a looping header under Eiji Kawashima's bar after Japan's defense failed to clear the ball.

Belgium tied it up five minutes later when Hazard crossed onto the head of Fellaini. Coach Roberto Martinez had sent on the Manchester United player after Japan went two up, and he did his job, heading down and past Kawashima.

Nishino brought on Keisuke Honda and the veteran Pachuca playmaker forced Courtois into an 83rd-minute save and another from a long free kick in injury time.

But then it all crumbled around Japan as Courtois released a ball to the sprinting Kevin De Bruyne, who pushed hard across the halfway line and released Thomas Meunier on the right.

(Marouane Fellaini (8) levels for Belgium)

Meunier crossed a ball that Romelu Lukaku stepped over, leaving it for Chadli to send Belgium to the quarterfinals.

"This is the frightening thing about the World Cup," said Nishino. "I wonder exactly what it is that we were lacking?"

"We still had the chance to get a third goal and there were periods where we were in control of the game and kept running, but Belgium showed their true colors."

Earlier in the day, Brazil impressed in their win over Mexico.

The South Americans' first goal began with a Neymar backheel to set Willian off into the box and was finished when the Paris Saint-Germain star met the Chelsea player's cross with a sliding finish for his second goal of the tournament.

Neymar was also central in the second, his effort deflected by Mexican goalkeeper Guillermo Ochoa into the path of Roberto Firmino, who had a simple finish.

Brazil became the World Cup's all-time top scorers on 228, two ahead of Germany, while Mexico have now been knocked out in the round of 16 at seven straight World Cups.