West Ham put a severe dent in Manchester City's title aspirations after earning a deserved 2-1 win at Upton Park.