India won the second Test by an innings and 239 runs on the fourth day to take a 1-0 lead in the three-match series.