After an unconvincing first-half, the Magpies moved up a gear after the break and Gayle took his tally to 11 goals for the season with two clinical finishes to overwhelm a gritty Barnsley side, who suffered a fifth defeat in six outings.
A frenetic opening saw few chances created, with returning Barnsley skipper Conor Hourihane having the game’s first real effort after 12 minutes, firing just wide from the edge of the box.
Gayle hooked a backheel just over the bar 10 minutes later, as he somehow connected with Matt Ritchie’s cross after setting the winger free down the right flank and bursting into the box to meet his delivery.
Newcastle, backed by a huge away following, had started the game impressively, but they were soon knocked out of their stride as the Reds harried and hustled them all over the park.
And 30 minutes in Barnsley went close again after Hourihane’s free-kick rebounded off the wall to right-back James Bree, who chanced his arm from 35 yards with the ball skidding just wide of Karl Darlow’s right-hand post.
Hourihane was booked for handball seven minutes shy of the break and from the resultant free-kick Gaye delivered a 30-yard shot straight at Reds goalkeeper Adam Davies.
The Reds went down the other end and won a set-piece of their own, with Sam Winnall’s low curler beating the wall but not Darlow in the United goal who saved comfortably.
It took Newcastle just three minutes of the second half to shake off their first-half blues with Gayle netting from close range.
Jonjo Shelvey saw a shot deflected wide from a Ritchie corner, and from the Scotland international’s next delivery the ball eventually reached Gayle at the back post and he fired the ball high past the despairing dive of Davies.
Winnall responded with a drive that flew narrowly over and, after Mohamed Diame struck an effort off target for the visitors, Adam Jackson flicked a header just wide from Marc Roberts’ cross as Barnsley pressed again.
Left-back Paul Dummett made a rare foray forward for the Magpies but lobbed an effort well over, before Gayle grabbed his second of the match after 68 minutes, latching on to a Ritchie through ball and lobbing the onrushing Davies from 25 yards out.
Paul Heckingbottom brought on Tom Bradshaw and Elliott Lee for Marley Watkins and Adam Hammill respectively in a bid to turn the tide, with the Reds boss and a clearly unhappy Hammill exchanging words as the winger headed for the dugout.
Davies did well to keep out a low Shelvey free-kick that deflected off Hourihane, before the home keeper saved well from Gayle to deny him a hat-trick.