Nervous Brazil beat Chile 3-2 on penalties to reach the World Cup quarter-finals on Saturday after an epic battle that left Neymar and his teammates in tears.
Two first half-goals were all the teams managed in a fast-paced and tense 120 minutes in the Mineirao Stadium.
Gonzalo Jara missed the decisive penalty for Chile, crashing his shot against the post and across the face of the goal, to continue his country's record of World Cup misery against Brazil.
Willian and Hulk both missed from the spot for Brazil, but David Luiz, Marcelo and Neymar all kept their cool to score while Julio Cesar made crucial saves from Mauricio Pinilla and Alexis Sanchez.
Neymar sank to his knees in disbelief afterwards amid widespread tears of joy. Some of the Chilean players hid their weeping under their shirts as they left the field.
Brazil sweat on Neymar injury after win
"We knew when the draw was made seven months ago that we might come up against Chile and we knew then how difficult it might be. Chile are a very well-organised team and it was a very well-balanced game," said relieved Brazil coach Luiz Felipe Scolari.
"We had three or four more chances to score a second goal and when you don't get that goal you always run a risk," he added.
Chile coach Jorge Sampaoli said: "I am sad because to play like this against the hosts and end up losing in the way we did is obviously very hard for us. The players did everything they could."
Earlier, Barcelona star Sanchez had pounced on poor Brazilian defending to equalise for Chile in the 32nd minute, cancelling out an 18th-minute opener for the hosts bundled in by Luiz.
Brazil had the majority of the chances but were jittery in the second half and were hugely lucky to survive at the end of extra time when substitute Pinilla lashed a shot against the bar from the edge of the area.
Scolari's side now look forward to the quarter-finals, while Chile contemplate a last-16 exit at the hands of Brazil, just as they suffered in 1998 and 2010.
As in all of their group games, Brazil started frantically amid a backdrop of deafening noise from the crowd of almost 60,000.
Chile were subjected to the sort of high and energetic pressing game they normally inflict upon others and Marcelo shot narrowly wide before English referee Howard Webb rejected loud appeals for a penalty when Hulk went down in the area after coming together with Mauricio Isla.
Brazil and their fans celebrated in the 18th minute, however. Neymar swung in a corner from the left and Thiago Silva headed the ball on towards the back post, where David Luiz bundled it in, with the help of Chile defender Jara.
Chile, who also lost to Brazil in the 1962 semi-finals, faced a huge challenge to come from behind, but Brazil allowed them to control possession and gifted an equaliser.Hulk made a careless pass, allowing Eduardo Vargas to pounce and set up Sanchez, who coolly beat Cesar in goal.
Sampaoli's side were then forced to weather a storm before half-time that saw a Neymar header deflected past the post and Claudio Bravo tip over a powerful 30-yard drive from Daniel Alves.
Chile looked more comfortable after the restart, even if they had a let-off 10 minutes into the second half when Hulk succeeded in turning the ball into the net and wheeled away in celebration.
Hulk thought he had redeemed himself for his error in Chile's equaliser, but the referee ruled that he had controlled the ball with his arm and brandished a yellow card to the burly forward.
As nerves took hold, Brazil needed Cesar to come to the rescue with a fine reaction save from a Charles Aranguiz shot, while Neymar, so often the hosts' source of genuine inspiration, faded from the game.
Instead Hulk came to the forefront. He delivered a glorious cross from the left that Jo, on in place of Fred, could not convert and then stung the palms of Bravo after accelerating into the box.
In the first period of extra time, Hulk produced another trademark thunderbolt from 30 yards that was blocked by Bravo.Chile, meanwhile, seemed happy to take their chances in the lottery of a penalty shoot-out. Pinilla almost won it right at the last, only for the woodwork to rescue Brazil, as it did again from Jara's crucial penalty.