Brazil secured a dramatic penalty shootout win against Chile to reach the last eight and set up an all-South American quarter-final against Colombia.
Goalkeeper Julio Cesar was the hero, making two crucial spot-kick saves, to thwart a relentless Chile side who were denied victory themselves by the woodwork late in an enthralling game.
That the hosts came close to making an unexpected exit in Belo Horizonte had a nation of more than 200m people holding its breath.
Cesar, who made just one appearance for Queens Park Rangers last season and went on loan to FC Toronto, redeemed an error he made which cost Brazil dear in the quarter-finals against Netherlands in 2010.
He saved from Mauricio Pinilla and Alexis Sanchez as Brazil went on to win a tense shootout 3-2.
Gonzalo Jara hit a post with the decisive spot-kick to prompt wild celebrations inside the Estadio Mineirao – and across the rest of this football-mad nation.
David Luiz and Marcelo had converted their efforts for Brazil, but with Willian and Hulk missing, it fell to the hosts’ star striker Neymar to step up under intense pressure and calmly slot home what proved the winning kick.
Luiz had earlier put the hosts in front, only for Alexis Sanchez to equalise. Hulk then had a strike disallowed for handball by English referee Howard Webb – fairly, but much to the anger of the home fans.
Pinilla also hit the crossbar for Chile in the final minute of extra time.
A high-tempo and high-quality first half, was followed by a poor second period which always suggested extra time might follow.
And what drama the penalty shootout produced. Brazil’s fans roared with relief while Chile were defeated, yet with their reputation as one of the game’s most dangerous sides significantly enhanced.
Having never lost to La Roja on home soil and having beaten them on all three of their previous World Cup meetings, Brazil arrived with history on their side.
Chile earned a 2-2 draw at the same venue last year but that was one of only two encounters in which they avoided defeat since last beating Brazil 14 years ago.
The noise in the stadium before before kick-off was astonishing, swathes of yellow dominating the pockets of red, and the atmosphere only intensified when Fernandinho went in late on Charles Aranguiz, and the Chile midfielder and team-mate Gary Medel responded in kind by wiping out Neymar.
After Webb turned down a penalty appeal at either end, Brazil soon took control and were rewarded for their pressure when Neymar’s corner was flicked on by captain Thiago Silva and steered into the net by what appeared a combination of Luiz and Chile defender Jara.
Brazil’s main threat was once again Neymar, the 22-year-old dragging a shot wide after racing towards goal and then being sent flying by Arturo Vidal’s reckless challenge.
Coach Luiz Felipe Scolari had warned his side they could not afford to make any mistakes in the knockout stage and he would have been furious with the way Chile were allowed back into contention.
Hulk’s poor control from Marcelo’s throw-in gifted possession to Eduardo Vargas and he quickly found Sanchez in the penalty area to drill a low finish across Cesar.
Brazil worked hard to regain the lead but the half ended with the hosts frantically scrambling to deny Aranguiz after carelessness from Luiz Gustavo.
The second half felt comparatively subdued until Webb’s big call arrived, either he or his assistant Mike Mullarkey judging Hulk to have controlled a pass with his arm before beating Bravo. It was a tough and unpopular decision but seemed, on the basis of television replays, to be the correct one.
A period of Chile pressure ensued as Cesar superbly denied Aranguiz from close range.
Former Manchester City striker Jo replaced Fred to a warm welcome – he now plays for local side Atletico Mineiro – and might have made a quick impact, but failed to connect with Hulk’s cross.
Bravo did well to repel a Neymar header and Hulk’s powerful strike, before again thwarting the much-improved Hulk in the first period of extra time.
Scolari played his final card by introducing Willian for a disappointing Oscar, but the weary Chileans – for whom the excellent Medel was carried off on a stretcher in tears – switched from an aggressive 3-1-4-2 formation to a defensive 5-1-3-1 and appeared intent on holding on for penalties.
They could, however, have snatched the most incredible of winners when substitute Pinilla rattled the bar powerfully in the final minute.
Penalties would be needed and Brazil held their nerve to make the last eight.