The visitors broke the deadlock in the 26th minute when George Poynton set up the lively David McMillan who worked his way across the 18-yard line before producing a superb left foot strike which flew into the top corner.
Rory Patterson should have equalised in the 59th minute but he failed to make contact with the ball and 10 minutes later the Derry striker was through again but his shot was blocked by Sava.
Those misses proved costly when Stephen Kenny’s side doubled their lead in the 74th minute.
McMillan gained possession and found Kurtis Byrne whose low shot screamed into the bottom corner giving goalkeeper, Gallagher, no chance.
However, with five minutes remaining Patrick McEleney pulled one back with another of his wonder strikes to insure a nervous ending to the game.
DERRY CITY: Gallagher; Collins, S. McEleney, Barry, Jarvis; Ventre; R. Curran, Foy (P. McEleney, 58), B. McNamee (Duffy, 77), T. McNamee (Tracey, 58); Patterson.
DUNDALK: Sava; Poynton, Kelly, Rossiter, Kaguako; O’Connor (Byrne, 59), McDonald, Higgins, Griffin (Finnigan, 90); McMillan, Ward (Mountney, 43).
Referee: D. McKeon (Dublin).