Harry Kane scored twice as Tottenham survived a late West Ham comeback to win 3-2 in the Premier League.