Early second-half goals from Patrick Hoban and Sean Murray kept Dundalk's slim European hopes alive against relegated Longford Town.
After a dour first half, Hoban opened the scoring within a minute of the restart before Murray added a second soon after to officially ensure the Lilywhites' place in the Premier Division next season.
The win also keeps Vinny Perth’s side in the hunt for Europe although they need slip-ups by fourth-placed Bohemians and Derry City - who they host on the final day - as well as an FAI Cup win for St Patrick’s Athletic to make that happen.
Longford gave a good account of themselves under caretaker boss John Martin following Daire Doyle’s departure last week but they struggled to create many clear cut openings to threaten another upset having taken five out of a possible nine points against Dundalk already this season.
While the Lilywhites now wait 12 days before playing again, it is a positive in their madcap season that their top-flight status is secured. Fans will now be hoping that the club’s future off the field is a little clearer by the time they play again, with captain Andy Boyle the only player to feature in this game who is contracted for next season.
The first half was a poor affair with just two shots on target, both for the home side.
Despite that it was the visitors who had the first early chances with Darragh Nugent and Aaron O’Driscoll having efforts blocked at close range after Dundalk failed to properly clear a corner on nine minutes.
Despite bossing possession, it would take the Louth men until the 28th minute to finally test Lee Steacy when a ball dropped to Hoban in the box from a corner but his left foot shot was saved by the keeper.
The only other chance of note came in first half stoppage time when Daniel Cleary’s diagonal ball picked out Michael Duffy on the left. The winger then cut inside to get a shot away but Steacy saved at his near post before gathering at the second attempt.
Just 54 seconds after the restart Hoban then popped up with his 125th goal for Dundalk to break the deadlock - heading in off the underside of the crossbar from Duffy's teasing cross from the left.
Duffy then went close to doubling his side’s lead on 50 minutes when he cut in off the left to get a curling right foot shot away but Steacy did brilliantly to push it away.
The second would arrive three minutes later with Murray rifling past Steacy from just outside the box off the inside of the post after a neat lay-off by Hoban and stepover by Daniel Kelly in the build-up.
Kelly and Darragh Leahy then passed up good chances to add to their side’s lead before Boyle was denied by a third by a superb block from O’Driscoll on the line after Longford failed to deal with a corner.
Duffy then fired well wide when clear through before Nugent had Longford’s first attempt on Peter Cherrie’s goal on 76 minutes with a strike from range that was straight at the keeper.
Steacy then frustrated Duffy yet again by pushing away a fierce strike three minutes later after the Derry man had been played in by Hoban.
O’Driscoll then made another fine intervention to deny substitute David McMillan soon after before Cherrie preserved his clean sheet on 84 minutes with a fine stop with his feet from Rob Manley after he had been slipped in by substitute Conor Davis.
Aaron Robinson did rattle the crossbar with a free kick in stoppage-time for the visitors but it wasn’t to be for the Midlanders as Dundalk claimed their first victory over them this season.
Dundalk: Peter Cherrie; Cameron Dummigan, Daniel Cleary, Andy Boyle, Darragh Leahy; Greg Sloggett (Sam Stanton 12), Will Patching; Daniel Kelly (David McMillan 59), Sean Murray (Sami Ben Amar 73), Michael Duffy; Patrick Hoban.
Longford Town: Lee Steacy; Shane Elworthy, Michael McDonnell, Aaron O’Driscoll, Paddy Kirk; Rob Manley, Aodh Dervin, Aaron Robinson, Darragh Nugent (Conor Davis 82), Dylan Grimes (Karl Chambers 63); Dean Williams (Matthew O’Brien 82).
Referee: Adriano Reale (Kildare).