Tottenham stay four points behind Premier League leaders Chelsea following a hard-fought victory at Crystal Palace.