EAST LANSING, Mich. (AP) Michigan had plenty of reasons to be motivated to beat Michigan State, barely defeating its in-state rival over the last decade and losing to every ranked team on the road for a dozen years.

The Wolverines, though, were even more fired up to win after a pregame spat with the Spartans.

Shea Patterson threw two touchdown passes and No. 6 Michigan earned a desperately needed 21-7 win over No. 24 Michigan State on Saturday, snapping a streak of 17 consecutive losses to ranked teams on the road.

The Wolverines (7-1, 5-0 Big Ten) had lost eight of 10 against coach Mark Dantonio's Spartans and those setbacks have led to them not winning a Big Ten title since 2004.

The matchup is always highly charged, but it was kicked up a notch well before kickoff, and emotions didn't subside even after a 75-minute weather delay during the first quarter.

Michigan State's team walked from one end zone to the other with their arms locked and a few Wolverines were stretching out in the middle of the field when contact was made and words were exchanged .

''Total bush league,'' Michigan coach Jim Harbaugh said. ''Apparently coach Dantonio was 5 yards behind, smiling.''

Dantonio disagreed with Harbaugh's assessment.

''That's B.S.,'' Dantonio said.

Michigan linebacker Devin Bush, one of the players involved in what Harbaugh called ''shenanigans ,'' later dragged and kicked his cleats to rip up some of the grass under the Spartans' white logo at midfield.

''I just got caught up in the moment with my emotions,'' Bush said.

The Spartans (4-3, 2-2) struggled to move the ball, getting held to 94 yards and failing to convert any of its 12 third downs.

''Our defense was lights out,'' Harbaugh said. ''That's a dream game.''

Michigan was good enough on offense to win, making some plays in the passing game and a lot on the ground against the nation's top-ranked rushing defense.

Patterson's 79-yard pass to Donovan Peoples-Jones put Michigan ahead late in the third quarter.

''Donovan, one-on-one coverage, good luck with that,'' Patterson said. ''I just threw it up to him.''

The mobile quarterback converted a fourth-and-2 from the Michigan State 41 early in the fourth, setting up Ben Mason's 5-yard run that gave the Wolverines a 21-7 lead.

The Ole Miss transfer was 14 of 25 for 212 yards and made a successful debut in a series that has been tilted Michigan State's way in part because of poor quarterback play. His 6-yard pass to Nico Collins broke a scoreless tie early in the second quarter and was Michigan's first touchdown throw against the Spartans since 2011.

Michigan State needed a fumble deep in Michigan territory and a trick play to score once.

Chris Evans lost the football at the Wolverines 7 early in the third. Two plays later, quarterback Brian Lewerke caught a 4-yard pass from receiver Darrell Stewart off a reverse to pull the Spartans into a tie.

Michigan's Karan Higdon had 144 yards rushing on 33 carries against a team that entered the game giving up a nation-low 62 yards on the ground.

''We didn't have enough offense,'' Dantonio said. ''Credit Michigan's defense. ''

OFFENSIVE WOES

LJ Scott returned from a leg injury to play for the Spartans after a four-game absence and ran for just 25 yards on 10 carries.

Lewerke was 5 of 25 for just 66 yards with an injury-depleted corps of receivers, which now includes Felton Davis after he was carted off during the game with an Achilles tendon injury. The quarterback was banged up, too, with a shoulder injury that kept him out of practice Monday through Thursday.

''I don't know whether it was the offense or him being dinged up or what,'' Dantonio said. ''I wanted to give him a chance to continue to play.''

THE TAKEAWAY

Michigan: Harbaugh needed the victory after entering the game 1-5 against rivals Michigan State and Ohio State. If the Wolverines beat No. 18 Penn State in two weeks, they will be set up for a showdown Nov. 24 at Ohio State.

Michigan State: Lewerke's inconsistent play is slowing down an offense already hurt by ailments. His injury adds another obstacle to him bouncing back.

POLL IMPLICATIONS

The Wolverines should be moving up, especially after No. 2 Ohio State lost to Purdue. Michigan State is likely to be out of the rankings again.

UP NEXT

Michigan: Off until hosting Penn State on Nov. 3.

Michigan State: Plays Purdue at home.

---

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

---

Follow Larry Lage at www.Twitter.com/larrylage

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