Neymar's penalty in a shootout proved decisive when Chile's former Nottingham Forest, West Brom and Brighton defender Gonzalo Jara smashed the final spot-kick against the post.
The win keeps alive Brazil's dreams of winning a World Cup on home soil - and their record of not losing a competitive match at home since 1975.
Chile had taken Brazil all the way in Belo Horizonte, dominating for long spells of the second half and nearly snatching victory at the death through Mauricio Pinilla's strike which hit the crossbar.
Brazil had taken the lead through a goal awarded to David Luiz - although it appeared to come off a Chile player - before Chile netted a deserved equaliser through Alexis Sanchez.
"It was complicated," Brazil goalkeeper Julio Cesar said."The pressure of representing Brazil and playing at home is really great. We played well in the first half, but after Chile equalised they got into the game."
Brazil's win also saved English referee Howard Webb from becoming the country's public enemy number one after he found himself at the centre of huge controversy when he disallowed a goal by Brazil forward Hulk for handball.
If the hosts had enjoyed the rub of the green from officials in previous matches - something that had been flagged up by Chile - there was no danger of such an accusation being made against Webb.
He had also turned down a penalty claim by Hulk, as well as one by Chile's Eduardo Vargas, while Brazil coach Luiz Felipe Scolari was furious he did not take a tougher line on some forceful challenges on Neymar.
It was Neymar who was the man at the centre of most of the action for Brazil in the first half but Marcelo shone first with a skilful turn on the edge of the box that fooled his marker and earned the Real Madrid full-back space to send a low shot just a yard past the post.
Chile looked threatening on the break but Brazil dominated possession and took the lead in the 18th minute - claimed by Luiz though probably an own goal.
Neymar's corner was headed on by Thiago Silva and it initially looked as though former Chelsea defender Luiz had finished at the far post but replays appeared to show it went in off Jara.
That should have been the signal for Brazil to assume total control but instead Chile pounced on a shoddy mistake to equalise.
Hulk messed up a return to Marcelo's throw-in by their own touchline, Vargas snapped up the ball and found Sanchez who neatly slotted home his second goal of the tournament.
Neymar continued to look Brazil's biggest hope and his header from Oscar's cross just bounced off a defender's arm which diverted the angle just enough to take it past the post.
Oscar found his range and his brilliant crossfield pass found Neymar again threatening but he dallied, Chile scrambled the ball clear but it ricocheted off Fred and just over the bar.
A dipping strike from distance by Dani Alves was turned over by Claudio Bravo, before Brazil's out-of-form striker Fred made perhaps the most embarrassing miss of the World Cup so far, mis-hitting the ball hopelessly just before the break.
Brazil always looked vulnerable and another error, by Luiz Gustavo this time, saw Sanchez threaten again but Luiz managed to hurl himself in to block for a corner.
The second half saw Brazil frustrated by nerves and by Webb, while Scolari's decision to push Neymar further forward saw him drop out of the game. Then came the controversy. Brazil believed they had gone in front after Marcelo's long ball was brought down by Hulk, who then sliced it into the bottom corner, but it was chalked off by an assistant's flag who said the striker controlled it with upper arm.
It was a controversial decision and to rub salt in the wound, Webb booked him.
Chile then began to assume an air of superiority while Brazil looked worried, and were grateful for a wonderful save by Julio Cesar who turned aside what looked a certain goal for the excellent Charles Aranguiz.
Former Manchester City striker Jo came on for Fred and looked destined to score straight away but somehow missed, then Neymar's flicked header was straight at Bravo. The Chile goalkeeper stood up strong again after brilliant work by Hulk, but it was Brazil who were relieved to take the game to extra time.
Oscar had a half-chance with a header and Bravo kept out Hulk but it was Chile who nearly snatched it at the death when Pinilla's blistering strike crashed back off the crossbar.
"It's at time like this you get your support from friends and team-mates and thanks to Julio who made great saves," said Hulk, who missed for Brazil in the shootout
"We ran till the end, God willing we will go to the end and make the final. We suffered but we made it. We knew this would be a very hard game, it went to extra time but even with cramp we ran till the end."