Belgium struck early and held off a late Brazil fightback to send the five-times champions tumbling out of the World Cup with a 2-1 victory in an end-to-end thriller, that earned them a semi-final against France.
A Fernandinho own goal and a brilliant Kevin De Bruyne strike gave Belgium a spot in the last four for the second time after 1986 and sent Brazil home at the quarter-final stage for the third time in the last four World Cups.
Brazil dominated possession and carved out chance after chance but could not score until substitute Renato Augusto headed home Philippe Coutinho's cross 14 minutes from time.
Roared on by the vast majority of the crowd at the Kazan Arena, the Brazilians poured forward to try and save the game but Roberto Firmino, Augusto and Coutinho spurned gilt-edged opportunities to level the scores.
If Belgium's first goal in the 13th minute had an element of luck, the ball going into the net off Fernandinho's shoulder from a corner, the second in the 31st minute was a shining example of counter-attacking football.
Romelu Lukaku took the ball with his back to goal, turned into space and stormed past Fernandinho up the pitch before releasing De Bruyne on his right for the playmaker to rifle the ball into the net from the edge of the box.
De Bruyne, playing in a more advanced role than he had in Belgium's previous four matches, was at the heart of his team's best work, managing the transition from rearguard defence to attack with vision, pace and accuracy.
This was no repeat of Belo Horizonte four years ago, when Brazil were thrashed 7-1 by Germany in the semi-finals on home soil, and Tite's side kept their shape and composure.
Belgium goalkeeper Thibaut Courtois, though, made a fine saves from Coutinho and Serbian referee Milorad Mazic waved away penalty appeals from Neymar and Gabriel Jesus.
The Brazilians finally got some reward for their efforts with Augusto's header and Belgium needed a brilliant fingertip Courtois save from Neymar in the last seconds to secure a date with neighbours France in St Petersburg on Tuesday.