Derry started the match strongly at the Ryan McBride Brandywell with Liam Boyce’s header just over and Michael Duffy unable to keep his free kick on target.

In the 15th minute, James Clarke beat his marker to connect with Brooklyn Lyons-Foster’s pass with his effort denied by the right hand post.

Clarke had another good chance shortly after but could not steer Duffy’s pass home from point-blank range.

However, the home side would take the lead when Darragh Burns corner was met by a powerful header from Cotter.

Just seconds later, Duffy’s strike crashed off the crossbar as Derry’s confidence started to grow.

The Candystripes would extend their lead on 65 minutes when O’Reilly played a clever one-two with Boyce and fired past stopper Sam Sargeant.

Sligo continued to struggle to create their own chances, but so did the home side in the closing stages of an important win at the end of a turbulent week.

Elsewhere, leaders Shamrock Rovers beat Dundalk 3-2, while Galway were held to a goalless draw against Drogheda.

Derry will now aim to use this momentum when they face UC Dublin in the FAI Cup quarter-finals on Friday, 14 August.