EAST LANSING, Mich. -- For most of this game, it felt like Michigan State was always one play away from being in real trouble.

Connor Cook never let it come to that.

Cook threw for 398 yards and four touchdowns, and No. 7 Michigan State remained undefeated with a 52-26 win over Indiana on Saturday. Cook threw all four of his touchdown passes on third down, and he fell just short of the school record of 400 yards passing, set by Bill Burke in 1999 against Michigan.

The Spartans (8-0, 4-0 Big Ten) never trailed in the second half, but it was touch and go until Cook found R.J. Shelton for a 10-yard touchdown pass with 4:57 remaining to give Michigan State a 12-point lead.

The Spartans then tacked on two more TDs to avoid an upset a week after their unforgettable win at Michigan. Michigan State has won 12 in a row for the first time since 1956. This run is tied for the third-longest winning streak in school history.

Indiana (4-4, 0-4) was outscored 24-0 in the fourth quarter.

Indiana's Griffin Oakes missed two extra points and a field goal for the Hoosiers, who allowed over 50 points for the second consecutive week. Nate Sudfeld threw for 308 yards and three touchdowns for Indiana.

The Spartans won by double digits for the first time in Big Ten play. Their victory last weekend -- when Michigan's punter fumbled a snap on the final play and the Spartans scored a touchdown -- was the talk of college football, but Michigan State didn't need any last-second dramatics this time.

Michigan State trailed 7-0 in the first quarter when Cook threw a 22-yard touchdown pass to Shelton right as it began to rain hard at Spartan Stadium. The sheets of rain prevented Indiana from doing much of anything on its next possession, and then the downpour eased when Michigan State got the ball back.

The Spartans took a 14-7 lead on a 1-yard touchdown run by Delton Williams. Sudfeld answered with an 11-yard scoring pass to Ricky Jones, but Oakes missed the extra point.

Cook and Sudfeld traded touchdown passes in the final two minutes of the half, and with Michigan State up 21-20 early in the third, Cook slipped a pass to tight end Josiah Price for a 13-yard touchdown on third-and-goal.

The Hoosiers breezed back down the field, scoring on Sudfeld's 3-yard pass to Andre Booker, but another missed extra point left the score at 28-26.

Indiana wouldn't score again. Cook's second touchdown pass to Shelton made it 38-26, and after that Michigan State finally began asserting itself on the ground. LJ Scott scored on a 26-yard run, and Gerald Holmes scored on a 22-yarder as the Spartans turned the game into a rout in the final minutes.