Jonjo Shelvey made an impressive debut for Newcastle as he helped his side move out of the relegation zone with a win over West Ham.