Matty Smith scored a hat-trick as St Patrick's Athletic made it three big wins in eight days.
A fourth victory of the campaign over relegated Longford, coupled to Derry not winning, means second-placed St Pat's confirm their place in Europe for next season.
With Monday's FAI Cup final rehearsal with Bohemians in mind, Saints' manager Stephen O'Donnell made six changes to this starting eleven as midfielder Chris Forrester and striker Smith returned from suspension.
With four changes from their 1-0 defeat to Shamrock Rovers last Saturday, Longford started brightly, Aaron O'Driscoll glancing a header from an Aodh Dervin corner wide across goal with four minutes up on the watch.
Three minutes later, a mistake by Forrester gifted possession to Karl Chambers who threaded Rob Manley down the inside right channel. The low cross never reached Karl Chambers at the back post as Saints cleared.
Slow to start, St Pat's finally threatened for the first time on 11 minutes, Jay McClelland cutting in from the left flank to arrow a right-footed shot into the side netting.
Town midfielder Darragh Nugent then had to get across well tobravely block a thumping drive from Jamie Lennon minutes later.
The home side continued to trouble a sluggish St Pat's when they got forward with Vitezslav Jaros having to make the first save of the game to push a Dean Williams header round a post following a superbly delivered, arcing cross from left-back Paddy Kirk.
In an open game, Sam Bone was given a little too much space to rifle a drive inches over the Longford crossbar before the home side once more got in behind the sluggish Saints defence on 25 minutes. Slipped in by Manley, Williams' shot had to be palmed away by Jaros.
Out of sorts at one end they may have been, but Saints were clinical with their first real chance on 29 minutes as they took the lead.
Forrester cleverly flicked a ball through a packed Longford area for Smith who took the dropping ball on the volley with his left foot to blast it to the net.
Referee Ray Matthews incensed Longford when dismissing their justifiable looking claims for a 36th minute penalty when Paddy Barrett appeared to trip Manley inside the area.
St Pat's first real spell of pressure then saw them double their lead a minute before the break.
Longford skipper Dean Zambra initially cleared off the line from James Abankwah to concede a corner.
But the marking was poor from Robbie Benson's delivery as Smith got his head to it at the near post to force the ball home.
The lively Williams got Longford back into the game six minute into the second half.
Despite appearing offside, the flag wasn't raised as the Shamrock Rovers loanee skipped clear onto Dervin's pass to cut back inside both Barrett and Abankwah before shooting past Jaros.
Longford chased the game hard and had a second penalty appeal waved away on 76 minutes when Saints' skipper Ian Bermingham appeared to handle a shot from Aaron Robinson.
But St Pat's sealed their win on 84 minutes.
Darragh Burns and Smith combined on the right to set up substitute Alfie Lewis who smashed the ball to the net off his left.
Smith then completed his hat-trick in the first minute of stoppage time when tapping home Burns' cross following Jamie Lennon's superb through ball.