Jordan Ayew headed the visitors into the lead on the hour mark, but Joselu equalised within three minutes of his introduction to salvage the Magpies a point.
Nevertheless, Rafael Benitez's side are now winless in seven home league matches.
Newcastle had a couple of chances in the opening 20 minutes as Gayle headed wide from a cross from Perez, who later shot straight at Lukasz Fabianski from a through-ball from his strike partner.
Defender Paul Dummett then joined in a Newcastle attack, feeding Christian Atsu down the left and continuing his run to meet a return pass with a sweet left-footed shot which whistled over the crossbar.
While Swansea had a greater share of possession, the Magpies had more cutting edge and Matt Ritchie opened up the visiting defence with a lofted pass from which Perez forced a strong save from Fabianski.
There were not too many complaints to referee Graham Scott from Swansea players, but they may have felt aggrieved had a poacher's finish from Gayle two minutes later not been ruled out for offside.
With Newcastle having failed to find the net in six of their last seven home league games, and Swansea the lowest scorers in the division, a stalemate seemed likely before two goals in eight second-half minutes.
The home defence allowed Ayew two free headers in the box and, after Karl Darlow saved the initial effort with a diving save, the Ghana international forward nodded the rebound into a vacant net.
Swansea would have moved to within two points of safety with victory, but their lead lasted only eight minutes as Joselu took advantage of space afforded to him by Alfie Mawson to find the bottom corner on 68 minutes.
That strike did not give Newcastle the momentum it should have done and Swansea regrouped to keep their hosts at bay for the remainder of the game, while nearly snatching victory themselves in stoppage time.
Wilfried Bony's flick on was chased down by Luciano Narsingh, who was thwarted by Darlow racing off his line. The loose ball fell to Bony, whose shot was cleared in front of his own goal by DeAndre Yedlin.
Although his side remain bottom of the table, Swans boss Carlos Carvalhal may be quite content with a draw, which keeps one of their relegation rivals within touching distance - Newcastle are six points above in 14th.
NEWCASTLE (4-4-1-1): Darlow; Yedlin, Lascelles, Clark, Dummett; Ritchie, Shelvey (Merino, 82'), Diame, Atsu; Perez; Gayle (Joselu, 64')
SWANSEA (4-3-3): Fabianski; Van der Hoorn (Roberts, 65'), Bartley, Mawson, Olsson; Carroll, Clucas, Ki; Ayew, Dyer (Narsingh, 85'), McBurnie (Bony, 71')