Van der Hoorn’s cross found Ayew and while his initial effort was kept out he pounced to head home the rebound and hand Swansea the lead.
Two minutes later a left-wing cross from Paul Dummett found Gayle who headed straight at the goalkeeper.
Newcastle had made a positive start to the game and managed to force a corner in the first few seconds after good work from Ayoze Perez and Dwight Gayle.
On nine minutes Mo Diame latched on to a loose ball, but after taking a touch sent his shot wide of the target.
However, Swansea felt that Diame had used his arm to deny Mike Van Der Hoorn but ref Graham Scott waved play on.
When United dust themselves down this could prove to be a good a point but these are the type of games Newcastle should really be winning.
The big fear for United fans at half-time was their side’s inability to convert chances when on top.
A Ki Sung-Yueng shot was blocked on 35 minutes and Swansea followed up with a goalmouth scramble but Newcastle cleared their lines.
Gayle did head the ball past Fabianski seven minutes before the break but the goal was chalked off for an offside call.