Newport, 82 rungs below City on the English football ladder, rattled Pep Guardiola's aristocrats in the first half and Tyreeq Bakinson almost gave them a dream lead.
But City's class showed in the second half and once Leroy Sane's powerful shot from a tight angle put them in front after 51 minutes the chances of a seismic Cup shock faded away.
Foden's 75th-minute shot crept in at the near post to subdue the home fans but when Padraig Amond replied in the 88th minute a grandstand finish looked on the cards.
A second goal for youngster Foden arrived 71 seconds later though before Riyad Mahrez rubbed salt into Newport's wounds with virtually the last kick of the game as City claimed a 12th win in 13 matches in all competitions.
Chris Hughton's side took a 2-0 half-time lead through Anthony Knockaert and Jurgen Locadia but had to endure an anxious finale after former Arsenal and Chelsea star Cole, a seven-time FA Cup winner, headed in with just under 10 minutes remaining.
But Cole ensured their progress ended up being far from comfortable, finishing smartly after a wayward clearance from defender Dan Burn.
Championship side Millwall joined Brighton and City in the last eight with a 1-0 win in a tight game at League One AFC Wimbledon.
Wimbledon almost made a dream start after only two minutes when forward Joe Pigott hit the post -- but within a few minutes the Dons were behind.
Millwall struck with five minutes gone when Ryan Leonard crossed for Murray Wallace, whose dramatic late winner knocked out Premier League Everton in the previous round, to head home.
Wimbledon kept pressing, Michael Folivi causing problems and Adedeji Oshilaja heading over, but Millwall could have added another when Lee Gregory was denied by fine last-ditch defending.
Information from Reuters was used in this report.