EAST LANSING, Mich. (AP) On a day when Northwestern had little choice but to pass early and often, Clayton Thorson was up to the task.

Thorson threw for 373 yards and three touchdowns, and the Wildcats recovered from another second-half slip to beat No. 20 Michigan State 29-19 on Saturday.

The Spartans (3-2, 1-1 Big Ten) entered with the nation's top-ranked run defense and held Northwestern (2-3, 2-1) to 8 yards on the ground, but it didn't matter. The Wildcats moved the ball consistently well through the air, and Michigan State's offense was mostly inept except for a brief stretch in the third quarter.

''I think this was one of my best games in responding when bad things happen,'' Thorson said. ''We don't win a lot when I throw two picks. So really credit to our guys for staying in it.''

Thorson threw a 21-yard scoring pass to Cameron Green with 15 seconds left in the third, and a 2-point conversion gave Northwestern a 22-19 lead.

The Wildcats missed a field goal with 6:41 to play, but Michigan State went 15 yards backward on the ensuing possession and had to punt. The Spartans held again defensively, and on the next possession, they had second-and-1 from their own 11. After two near-sacks, running back Connor Heyward was stopped on fourth down. Thorson scored on a 2-yard run to make it a 10-point game with 2:51 left.

''We'll find the answers. I feel pretty confident in that,'' Michigan State coach Mark Dantonio said. ''We'll right the ship.''

The Spartans took advantage of a first-quarter interception and led 3-0, but Thorson connected with Kyric McGowan for a 77-yard touchdown with 18 seconds left in the period. Thorson found JJ Jefferson for a 34-yard TD in the second, and Northwestern led 14-6 at halftime.

The Wildcats blew a 21-3 halftime lead in a loss to Akron and were up 17-0 in the first half in last weekend's loss to Michigan . They also gave away the lead against Michigan State in a quick sequence during the third quarter.

Felton Davis scored for the Spartans on a 48-yard reverse , and although a 2-point conversion attempt failed, Michigan State got the ball back on an interception and took a 19-14 lead on Brian Lewerke's 3-yard touchdown pass to Davis.

Northwestern recovered, however, and won on a day when the Wildcats looked like the better team.

''We lost some momentum there in the third quarter and we were able to seize it back,'' Northwestern coach Pat Fitzgerald said. ''We've been really close the last three weeks and to come in here against an outstanding football team and get the win, I'm incredibly proud of our guys.''

THE TAKEAWAY

Northwestern: The Wildcats earned this win. Northwestern had the right plan, throwing 47 passes against a Michigan State team that excels at stopping the run, and the Wildcats also were impressive defensively in the final quarter.

Michigan State: With plenty of returning starters from a team that won 10 games a season ago, the Spartans have been a disappointment so far. They've had injuries - running back LJ Scott and receiver Cody White were out Saturday - and both the offensive line and secondary now seem like real problems.

THREE STRAIGHT

This was Northwestern's third straight victory over Michigan State. In those three games, Thorson has completed 70 percent of his passes. He's thrown for 1,010 yards and eight touchdowns with three interceptions.

GRABBING ON

Northwestern's Roderick Campbell was called for pass interference in the third quarter when he appeared to grab Davis' long hair to prevent the Michigan State receiver from getting open. Davis said that happens from time to time.

''More times in practice than during the game,'' he said.

RECORD

Michigan State's Matt Coghlin kicked two field goals, and the second set a school record - his 16th straight successful attempt.

POLL IMPLICATIONS

It's hard to see Michigan State staying in the Top 25 after this double-digit loss at home.

UP NEXT

Northwestern: The Wildcats host Nebraska next Saturday.

Michigan State: The Spartans play at Penn State next Saturday, the start of a tough stretch in the schedule that includes a game against Michigan the following week.

---

More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25

---

Follow Noah Trister at www.Twitter.com/noahtrister

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.