Newcastle striker Perez netted in the 27th and 31st minutes and added a late clincher four minutes from time to move onto 10 top-flight goals for the season.
Substitute Mario Lemina's first league goal in 14 months, combined with injuries to Miguel Almiron and Fabian Schar, made for a tense second half for the hosts, but they prevailed to leave Southampton with work to do to secure their own survival.
Newcastle had an early penalty claim turned down when Almiron's shot was blocked by hand of Pierre-Emile Hojbjerg at close range, before the Paraguay international had a blistering strike tipped over by Angus Gunn.
Home players were fuming with referee Anthony Taylor again when he only showed James Ward-Prowse a yellow card for bringing down Almiron near the halfway line as he raced towards goal, Rafael Benitez's assistant Mikel Antia sent to the stands for his protests.
But the mood at St James' Park improved rapidly when Perez struck twice in under four minutes. First, he showed strength to hold off Maya Yoshida and send a fine finish into the far corner after Isaac Hayden's tackle had set up the chance, before the Spaniard converted Salomon Rondon's precise cross with a sliding back-post finish from six yards.
Southampton brought on Lemina and Stuart Armstrong at half-time, but it was almost game over when Ki Sung-yueng fired a low strike against the foot of the post from almost 25 yards.
The visitors took advantage of that reprieve by getting back into the game in the 59th minute, Lemina confidently finding the bottom corner from the edge of the box after being set up by Nathan Redmond and Armstrong.
Newcastle lost both a tearful Almiron and then Schar to injuries, and tensions were high when Yoshida blazed over a glorious chance to equalise from six yards.
Gunn then made a superb save from Hayden's deflected strike and Rondon's header was cleared off the line by Ward-Prowse, but a third goal arrived when Perez cleverly diverted Matt Ritchie's diving header past the keeper.
What does it mean? Saints still have work to do
Southampton paid the price for a poor first half performance where they struggled to contain Newcastle and offered little at the other end. As a result, they remain five points clear of third-bottom Cardiff City, who host title-chasing Liverpool on Sunday, with four games to play.
Meanwhile, 12th-placed Newcastle have now won two straight games and are 10 points clear of the Welsh side. They are likely to be mathematically safe before they play again, and the club's focus now turns towards keeping Benitez.
Perez produces when it matters
In-form Perez has reached 10 Premier League goals for the first time since joining Newcastle in 2014. He came in for criticism from Newcastle fans earlier in the season, but has responded in style since then – eight of his 11 goals in all competitions coming in 2019 - and proven key to their survival.
3 - Ayoze Perez is the first Newcastle player to score a hat-trick in the Premier League since October 2015, when Georginio Wijnaldum netted four goals against Norwich. Beaming. #NEWSOU pic.twitter.com/g9N7t3zn5F— OptaJoe (@OptaJoe) April 20, 2019
Yoshida found out for Saints
Yoshida had a poor day at the office. He failed to halt Perez's run for the first goal, was unable to block Rondon's cross for the second, and later squandered a wonderful chance to equalise from close range when Nathan Redmond had picked him out with the match in the balance at 2-1. Having made a strong start to the second half, Saints lost all their momentum from there.
Key Opta Facts
This was Newcastle's sixth home Premier League win of 2019 – only Man City (8) and Arsenal (7) have won more.
Southampton have lost three of their last four away Premier League games (W1 D0 L3), having lost just one of their first four away matches under Ralph Hasenhuttl (W2 D2 L1).
Perez's hat-trick was Newcastle's first in the Premier League since October 2015, when Georginio Wijnaldum scored four times against Norwich City.
Perez has scored 10 Premier League goals this season – his best tally in a single top-flight season for Newcastle United.
Perez has scored seven goals in his last seven Premier League appearances at St. James' Park.
Rondon has been involved in more Premier League goals than any other Newcastle player this season (15 – 9 goals, 6 assists).