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.