Goals from Christy Fagan, James Chambers and Aaron Greene, coupled to a fine goalkeeping display by Conor O'Malley, ended a four-match losing streak in the league for St Patrick's Athletic at the City Calling Stadium.
Liam Buckley's side remain fourth in the table, five points behind Shamrock Rovers, though with a game in hand, as Longford look nervously over their shoulders in their battle to stay up.
Keen to get back to winning ways after four straight leagues defeats, St Pat's started on the front foot and were almost in front inside the opening minute.
Longford lost possession with Ian Bermingham getting forward from left-back, skipping past Noel Haverty, to pull the ball back for Greene whose shot wasn't far wide.
Last season's leading scorer Fagan, starting for the first time in over three months following injury, gave St Pat's a noticeably better shape.
He also duly gave the visitors a deserved early lead after four minutes.
Greene got the ball back from Bermingham on the left, did well to stay on his feet under a challenge to cross, where Fagan controlled the ball before turning and drilling home.
Longford responded well and were inches from equalising on 10 minutes.
A delightful ball from Dean Kelly fed Gary Shaw whose powerful shot from close range was brilliantly touched onto the bar and over for a corner by O'Malley.
The 21-year old St Pat's keeper came to his side's rescue again on seven minutes later.
Lorcan Shannon threaded Shaw through on goal and O'Malley was off his line smartly to make a commanding stop with his feet.
As if to thank their keeper, St. Pat's duly doubled their lead on 23 minutes. A foul on Killian Brennan was clinically punished by fellow midfielder Chambers, who found the corner of the net from the resulting free kick.
Pat's continued to cough up chances, with O'Malley once again having to make a good save to deprive Shaw who turned well to get his shot away from Kaleem Simon's cross from the right on 36 minutes.
The game continued to flow from end-to-end into the second half with Longford winger Simon shooting against a post ten minutes in.
Back at the other end, Greene failed to get enough purchase on Conan Byrne's corner as his header flashed wide.
But Greene clinched it for St Pat's on 75 minutes when running through onto Brennan's flick to blast an angled shot to the net.
Greene might have had a second goal five minutes from time, but his shot was deflected onto a post.
& copy; rte.ie