David Luiz claimed Brazil’s opener in the last-16 encounter after 18 minutes, but replays suggested that the final touch may have come from Gonzalo Jara after Thiago Silva flicked an inviting corner from Neymar towards the back post.
Neymar then dragged an effort wide after racing through on goal, but Chile found themselves level shortly after the half-hour mark as Alexis Sanchez capitalised on a lack of communication in the Brazil defence, firing beyond Julio Cesar and into the bottom corner.
Hulk had the ball in the back of the net and thought he had put Brazil ahead again shortly after the break, but those celebrations were short lived as English referee Howard Webb chalked off the goal for a perceived handball offence as the striker brought it under control.
Chile came close to taking the lead through Charles Aranguiz as he was denied by a superb Cesar stop after Mauricio Isla’s cutback, while Claudio Bravo thwarted Hulk with a fine save from inside the area as the game headed into extra-time.
Substitute Mauricio Pinilla almost stunned the hosts when he rattled the bar in the closing minutes of extra-time before Ramires fired wide for Brazil as the game headed to spot-kicks.
The shootout was tied at 2-2 after four penalties each, but Neymar dispatched his effort before Jara hit the post to send Brazil through to a clash with Colombia in Fortaleza on Friday.
The win keeps Brazil's dreams alive of winning a World Cup on home soil - and their record of not losing a competitive match at home since 1975.
It was Neymar who was the man at the centre of most of the action for Brazil in the first half, although 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 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 sloppy mistake to equalise in the 32nd minute.
Hulk messed up a return to Marcelo's throw-in by their own touchline, Eduardo 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 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 cross-field pass found Neymar again threatening but he dallied, Chile scrambled the ball clear - and it ricocheted off Fred, and just over the bar.
A dipping strike from distance by Dani Alves was turned over by Bravo, before Brazil's out-of-form striker Fred made perhaps the most embarrassing miss of the World Cup so far, mishitting the ball hopelessly just before the break.
But Brazil always looked vulnerable and another error, by Luiz Gustavo this time, saw Sanchez threaten again only for Luiz to hurl himself in to block for a corner.
Then came the controversy. Brazil believed they had gone in front after Marcelo's long ball was brought down by Hulk, who then sliced a shot into the bottom corner - but Webb said the striker controlled the ball with his upper arm. It was a controversial decision and to rub salt in the wound, Webb booked Hulk.
Chile then began to assume an air of superiority while Brazil looked worried, and were grateful for a wonderful save by Cesar to turn aside what looked a certain goal for the excellent 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 keeper 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, Bravo kept out Hulk but it was Chile who nearly snatched it at the death as Pinilla's blistering strike crashed back off the crossbar.
David Luiz opened the shootout by scoring confidently past Bravo, with Cesar then saving Pinilla's effort with his legs. Willian dragged his low spot-kick wide, but Cesar saved again, this time diving to his right to deny Sanchez.
Marcelo converted despite Bravo getting a hand to his effort, and Aranguiz emphatically dispatched Chile's third into the top corner. Hulk's penalty was then beaten away by Bravo, allowing Marcelo Diaz to plant his down the middle and level the shootout.
Neymar's tricky run-up fooled Bravo and opened up the goal for him to score, then came Jara's moment - a shot that rebounded off the inside of Cesar's left-hand post and flew across the face of goal and out, sending Brazil through to face Colombia in the last eight.
Sky customers with Sky Sports can register now and receive Sky Sports 5 as part of their sports package, at no extra cost, and as a further bonus they can also get two years’ free Sky Broadband Unlimited worth £7.50 a month. Activate our brand new channel.