Newcastle United ended a dismal run of five straight defeats with a 3-1 win over a Europe-chasing Brighton at St James' Park.