The only player on the pitch who looked like making a difference, Duffy fired home Robbie Benson’s cross in the dying seconds of a game which the home side had control of for the entirety of the second-half.

It was Duffy’s 10th League goal of the season and arguably his most important of all, with City on the verge of a frustrating fifth home draw in succession.

Instead, they now move four points ahead of Bohemians in second place with just three games remaining. It also delayed celebrations in Tallaght, with Shamrock Rovers set to be crowned champions if City failed to win.

Neither side were at their free-flowing best in a forgettable first-half, but Jad Hakiki was lively for Sligo and he offered the first threat of the game when he got a yard on the edge of the Derry box but sent a shot rising over the bar.

The in-form Adam O’Reilly had the best chance for the hosts just past the half-hour. Brandon Fleming sent Duffy racing on behind the Sligo defence, and his pull back found O’Reilly, who could only direct his first-time effort wide of the target.

O’Reilly should have done better five minutes later following a scintillating piece of attacking football from the home side.

Substitute Benson’s forward pass found Danny Mullen who, instead of shooting, cleverly touched the ball into O’Reilly in a better position, and the midfielder just needed to pick his spot but instead placed it straight at goalkeeper Sam Sargeant.

The Sligo goalkeeper was called into action properly for the first time in the opening stages of the second-half, preventing Duffy from scoring a superb individual goal.

Michael Duffy of Derry City heads the late winner against Sligo Rovers

Brian Maher quickly found Duffy on the left and his immaculate first touch allowed him to run at Gareth McElroy, leaving the Sligo man in his wake as he went all the way into the area, before being denied by Sargeant.

Sligo were hanging on as the game reached the hour mark and had to thank substitute Sean Stewart for saving them when Duffy got to a poor header from McElroy ahead of Sargeant.

The angle was against Duffy, who instead picked out Mullen, but his close-range effort was defected over the bar by a heroic challenge from the Sligo defender.

The pressure continued as Derry continued to look for a winning goal, with the combination of Fleming and Duffy on the left often too much for Sligo to handle; both players came close in the final stages with Fleming’s effort flashing across goal, before he then set up Duffy who just missed the upright with a bullet effort from 20 yards.

Derry looked to be out of ideas and time as the game entered four added minutes at the end of the 90, but there was still time for one last chance. Benson dummied to cross with his left and the ball eluded everyone, Sargeant included, to fire the ball home from close range at the back post.

Derry City: Maher, Boyce, Cann (Whyte 56), Connolly, Stott, Fleming; Winchester (Benson 27), Diallo (Dummigan 79); O’Reilly, Duffy; Mullen.

Sligo Rovers: Sargeant, Agbaje (Reynolds 87), Quirk, McClean, Fitzgerald, Hakiki, Kavanagh (Stewart HT), McManus (Harkin 65), O’Kane (Wolfe 87), Elding, McElroy (Denham 65).

Referee: Neil Doyle (Dublin)

Man of the Match: Michael Duffy (Derry City)

Match Rating: 6/10