Huddersfield, who failed to muster a single shot on target all afternoon, remain just three clear of the dropzone as their disappointing run of form continued in the North-East.
The first of Newcastle's first-half chances fell the way of Matt Ritchie, who was unable to lift the ball over Lossl after taking advantage of a fortunate bounce inside the box.
Two more presentable opportunities came and went for Gayle, as he lofted the ball a yard wide after being played through over the top by Shelvey, before blasting over from six yards when getting on the end of a right-sided cross.
Huddersfield, who had failed to score in a league-high 17 league matches this season heading into this one, struggled to really get going and were grateful to hear the half-time whistle.
Shelvey sliced wide from outside the box in the opening stages of the second half as Newcastle picked up from where they left off, but momentum was a lot more difficult to come by in the second 45.
As the game entered its final quarter the Magpies continued to probe away, with matchwinner Perez flicking his boot at a near-post cross but failing to find the target on this occasion.
Another of United's attacking players bagged the decisive goal, though, as Kenedy squared to Perez to sweep the ball home after Lossl failed to keep hold of a cross into the middle, moving Newcastle closer to another campaign of top-flight football.
NEWCASTLE UNITED (4-4-1-1): Dubravka; Dummett, Lascelles, Lejeune, Yedlin; Kenedy, Shelvey, Diame (Hayden 79'), Ritchie (Atsu 67'); Perez; Gayle (Slimani 75')
HUDDERSFIELD TOWN (4-2-3-1): Lossl; Smith (Mounie 83'), Kongolo, Schindler, Jorgensen; Hogg, Mooy; Van La Parra (Malone 86'), Pritchard, Kachunga (Quaner 56'); Depoitre