Bafetimbi Gomis and André Ayew scored for Swansea City as they defeated Newcastle United at Liberty Stadium.