Match ends, Newport County 1(4), Newcastle United 1(5).
Newcastle narrowly avoided becoming League Two Newport County's latest scalp as they scored a late equaliser before winning on penalties to reach the Carabao Cup quarter-finals.
Tristan Abrahams put the Exiles ahead in the fifth minute with a bouncing shot which Newcastle goalkeeper Mark Gillespie should have saved.
Scot Bennett and Padraig Amond missed chances to extend their lead, while County keeper Nick Townsend denied Ryan Fraser and Miguel Almiron.
Just as Newcastle's search for a late equaliser looked destined to end in vain, Jonjo Shelvey curled a beautiful shot into the top corner.
With no extra time played, that goal took the game straight to penalties, and it was Newport defender Brandon Cooper who missed the decisive penalty as he blasted over.
That was only the third missed spot-kick from 12 overall, with Newcastle's Joelinton and Newport's Ryan Taylor the others who failed to score.
Newcastle may feel they deserved victory with their second-half dominance but it was a cruel way for Newport to lose and miss out on another memorable cup upset.
In the past two years, they had beaten Leeds United, Leicester City and Middlesbrough in the FA Cup, while they had drawn with Tottenham and made life uncomfortable for Manchester City.
Mike Flynn's side had also accounted for two Championship clubs, Swansea City and Watford, in this season's EFL Cup to reach the last 16 for the first time.
County may have sensed another upset was in the offing when they saw Steve Bruce had made seven changes to the Newcastle side which had snatched a controversial 1-1 draw at Tottenham in the Premier League on Sunday - and the home side made the perfect start.
Scott Twine unleashed a fierce shot from 25 yards which dipped on to the crossbar and bounced out to Abrahams, who controlled the ball and struck a relatively tame effort which Gillespie could only help into the net.
The goal was a little fortuitous but Newport were well worth their lead, which they were twice close to doubling when Bennett and then Amond fired powerful half-volleys narrowly over.
Newcastle, by contrast, were lethargic and could only muster a handful of first-half shots on goal from Jacob Murphy and Shelvey.
The visitors had an excellent chance to equalise early in the second half but Ryan Fraser and Miguel Almiron were thwarted in quick succession by a superb double-save by Nick Townsend.
Bruce introduced two strikers worth a combined £60m, Callum Wilson and Joelinton, in an attempt to give Newcastle's attack a fresh impetus, and that prompted a period of sustained pressure.
For all their dominance of possession, however, Newcastle struggled to carve open their lower-league opponents.
On the rare occasions they did create clear scoring opportunities, they were confronted by determined Newport defending, which was strikingly evident when Cooper denied Fraser what seemed a certain goal with a brilliant sliding block.
Cooper's last-ditch intervention demonstrated how much cup ties like this can mean for clubs such as Newport, who received £125,000 for having this game televised - particularly precious as lower-league clubs count the cost of the coronavirus pandemic.
But this was not to be a match-winning contribution from Cooper.
With three minutes left, Shelvey turned just inside the Newport penalty area and stroked the ball into the top far corner with a brilliantly measured strike to take the game to penalties.
Then to compound Newport and Cooper's heartbreak, it was the young defender on loan from Swansea whose missed penalty gave Newcastle victory in the shoot-out.
Newport manager Mike Flynn:
"I am very proud. I couldn't be prouder if I tried. We were excellent and we have a fantastic group and it has taken a moment of magic to deny us.
"I know they had chances, but I thought we were brilliant and defended superbly. It's a great group of lads.
"I'm a realist and I won't get carried away. I know if we had won tonight it would have been a massive, massive upset.
"The players Newcastle brought on was a big compliment and they did have a fair bit of possession, but we kept our shape and composure. Jonjo Shelvey is the only player on the pitch who can put it in the top corner from that position.
Newcastle manager Steve Bruce:
"You can see how they've beaten Swansea and Watford. They play a certain way for a lower-division team.
"They get the goal early and, as if they didn't have enough belief, that gave them a bit more. They certainly had belief and we found it difficult against them - hats off to them.
"They defended with their lives at the end and it took a real bit of quality because, the way it was going, I didn't think we would get the breakthrough.
"But we're through. I thought we played well in the last half an hour.
"I don't know if the lads enjoyed their cold showers at the end because there was no hot water. It's not something they're used to and it was quite amusing."
- 17BennettSubstituted forWillmottat 80'minutes
- 19TwineSubstituted forCollinsat 90+4'minutes
- 9AmondBooked at 31minsSubstituted forTaylorat 80'minutes
- 17KrafthSubstituted forSchärat 71'minutes
- 36S Longstaff
- 8ShelveyBooked at 16mins
- 24AlmirónSubstituted forC Wilsonat 62'minutes
- 7CarrollSubstituted forJoelintonat 62'minutes
- 13C Wilson
- John Brooks
- Shots on Target
Penalty Shootout ends, Newport County 1(4), Newcastle United 1(5).
Penalty missed! Bad penalty by Brandon Cooper (Newport County) right footed shot is too high. Brandon Cooper should be disappointed.
Goal! Newport County 1(4), Newcastle United 1(5). Sean Longstaff (Newcastle United) converts the penalty with a right footed shot to the bottom right corner.
Goal! Newport County 1(4), Newcastle United 1(4). Matthew Dolan (Newport County) converts the penalty with a left footed shot to the bottom left corner.
Goal! Newport County 1(3), Newcastle United 1(4). Jacob Murphy (Newcastle United) converts the penalty with a right footed shot to the top right corner.
Penalty saved! Ryan Taylor (Newport County) fails to capitalise on this great opportunity, left footed shot saved in the bottom left corner.
Goal! Newport County 1(3), Newcastle United 1(3). Jonjo Shelvey (Newcastle United) converts the penalty with a right footed shot to the bottom right corner.
Goal! Newport County 1(3), Newcastle United 1(2). Josh Sheehan (Newport County) converts the penalty with a right footed shot to the bottom left corner.
Goal! Newport County 1(2), Newcastle United 1(2). Fabian Schär (Newcastle United) converts the penalty with a right footed shot to the bottom left corner.
Goal! Newport County 1(2), Newcastle United 1(1). Tristan Abrahams (Newport County) converts the penalty with a left footed shot to the bottom right corner.
Penalty saved! Joelinton (Newcastle United) fails to capitalise on this great opportunity, right footed shot saved in the bottom left corner.
Goal! Newport County 1(1), Newcastle United 1(1). Mickey Demetriou (Newport County) converts the penalty with a left footed shot to the bottom left corner.
Goal! Newport County 1, Newcastle United 1(1). Callum Wilson (Newcastle United) converts the penalty with a right footed shot to the bottom right corner.
Penalty Shootout begins Newport County 1, Newcastle United 1.
Second Half ends, Newport County 1, Newcastle United 1.
Attempt blocked. Sean Longstaff (Newcastle United) right footed shot from the centre of the box is blocked.
Attempt blocked. Federico Fernández (Newcastle United) right footed shot from the left side of the box is blocked. Assisted by Joelinton with a cross.
Corner, Newcastle United. Conceded by Ryan Haynes.
Attempt blocked. Jonjo Shelvey (Newcastle United) right footed shot from outside the box is blocked.