The Ghanaian striker 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.
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.
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.
Ayew's compatriot Christian Atsu played full throttle for Newcastle.