Antoine Griezmann ended his LaLiga scoring drought with 33 minutes gone at the Nou Camp, before Sergi Roberto doubled the home side's advantage just six minutes later to leave Getafe facing an uphill task.
Substitute Angel Rodriguez pulled one back for the visitors shortly after the hour mark, and he then had an effort clawed off the line by goalkeeper Marc-Andre Ter Stegen.
Getafe have been the surprise package this season and headed into Saturday's encounter just one place behind their opponents following a run of four successive wins.
But following a VAR review, the strike was chalked off after Nyom was adjudged to have fouled Samuel Umtiti in the build-up.
With 12 minutes remaining until the interval, Griezmann put the home side in front.
Lionel Messi's perfect pass found the former Atletico Madrid striker, who made no mistake with his finish, clipping the ball over Getafe keeper David Soria, to score in the league for the first time since netting in a 4-1 win against Alaves on December 21.
Barcelona appeared to have all-but killed the game after 39 minutes when Roberto scored just the second league goal of his career.
Roberto, whose only other league strike for Barca came in a 2-0 home win against Real Betis in August 2017, converted at the back post following Junior Firpo's cross.
It marked Barcelona's eighth league goal of the Setien era, and remarkably it was the first which Messi had played no part, either by scoring or laying on an assist.
Moments later, Rodriguez, who has scored eight league goals as a substitute this term, provided the hosts with a real fright when his flicked-shot was stopped by Ter Stegen, who then prevented Mata from netting the rebound.
Setien's side were on the ropes but they did enough to take all three points and retain hope of defending their LaLiga title.