Manchester City avoided FA Cup humiliation after their late comeback broke Cheltenham’s hearts.

Phil Foden, Gabriel Jesus and Ferran Torres struck in the final nine minutes to claim a 3-1 victory and dodge one of the biggest giant-killings in the competition’s history.

Alfie May’s opener almost earned the impressive Robins a stunning upset at the Jonny-Rocks Stadium.

The Sky Bet League Two Robins sat 72 places below City but went toe-to-toe with their visitors, with Michael Duff’s underdogs matching the six-time winners until the late recovery.

City now go to Swansea in the fifth round after their scare in Gloucestershire.

Cheltenham were bright from the start with City forced to defend but the visitors were denied an opener after 12 minutes.

Tommy Doyle’s cross was half cleared to Benjamin Mendy and the defender’s angled rocket was brilliantly cleared off the line by a diving Ben Tozer.

It was the cue for City to take control and Chris Clements’ loose pass produced a chance when it landed at Mendy’s feet.

The defender slipped in Foden and he crossed for Torres, who was thwarted by Josh Griffiths’ low save.

Jesus headed over soon after but the Robins conjured their own opening after 23 minutes.

May had been a lively spark – sitting on Eric Garcia’s shoulder – and he latched on to George Lloyd’s header but Zack Steffen turned his low effort behind.

It would have scared City and they continued to misfire as Foden fired Mendy’s cut back wide, with Fernandinho off target soon after.

The expensively assembled visitors were yet to open up the organised and committed hosts. The Robins remained confident on the ball and resolute in defence, forcing Pep Guardiola’s men to shoot from distance.

Play was halted for four minutes just before the break after fireworks were set off behind the Colin Farmer Stand but Cheltenham navigated the extended stoppage time.

Boss Michael Duff quipped before the game a weekly wage at City would pay the Robins’ payroll for a couple of months but there was nothing to separate them at the break.

Fireworks halted the game briefly
Fireworks halted the game briefly (Nick Potts/PA)

Cheltenham needed Jesus to miss a glorious chance after 53 minutes to keep the scores level. Foden’s cute through ball sent the striker clear but with just Griffiths to beat he hit the outside of a post from 15 yards.

It proved a costly miss as the Robins stunned City to take the lead six minutes later.

Tozer’s long throw had been a threat and this time the visitors failed to deal with it. They allowed May to run in unchecked and, when the ball was flicked into the six-yard box, the striker nipped in ahead of Mendy and Steffen to smash in from close range.

It forced City to up the tempo and Griffiths saved from Riyad Mahrez after Foden slipped the forward in.

Guardiola’s side looked to have few answers but they finally overcame their hosts in the final 10 minutes.

Foden had been their best player and he levelled with nine minutes left, volleying in Joao Cancelo’s cross.

Jesus then completed the turnaround three minutes later when, just onside, he blasted in Fernandinho’s pass and Torres added a third with the final kick of the game.