Updated

Brendan Gibbons made a 38-yard field goal with 5 seconds left, lifting No. 23 Michigan to a 12-10 win over Michigan State on Saturday.

The Wolverines (5-2, 3-0 Big Ten) beat the Spartans (4-4, 1-3) for the first time since 2007 to avoid a school-record, five-game losing streak in the series.

Denard Robinson threw a 20-yard pass to Drew Dileo to set up the game-winning kick.

Michigan State's Dan Conroy made a go-ahead field goal with 5:48 left after a fake punt kept the drive alive. The Spartans forced the Wolverines to punt from midfield after going ahead, but couldn't stop them when it mattered most in the final minute.

It was the 900th win for Michigan, college football's winningest program.

This one was the sweetest for the Wolverines since they snapped a school-record, seven-game skid against Ohio State last season.

Michigan's players sprinted toward the student section to celebrate after the win, and the fans in turn, spilled out onto the field, covering so much of it that Michigan State's marching band walked off the field without playing a note of its planned postgame performance.

Robinson, who had been shut down in his two previous starts against the Spartans, made just enough plays to help Michigan win.

He was 14 of 29 for 163 yards with an interception, a harmless turnover on an up-for-grabs pass at the end of the first half, and ran for 96 yards on 20 carries.

Dileo was his top target, catching four passes for 92 yards to set up scores on a day in which the defenses for both teams were dominant.

Michigan State's much-maligned quarterback, Andrew Maxwell, played relatively well, but he threw an interception to Jordan Kovacs that helped the Wolverines take a 9-7 lead early in the fourth quarter.

Maxwell was 21 of 34 for 192 yards with a TD — a 2-yard toss to Paul Lang — that put the Spartans ahead 7-6 midway through the third quarter. Those were the first points Michigan's improving defense gave up in six quarters and the first TD in eight quarters.

Le'Veon Bell, who was averaging 131 yards rushing a game, had just 68 yards rushing on 26 carries and gained no more than 8 yards on any attempts against a defense designed to stop him.

Michigan State coach Mark Dantonio, who called a fake field goal in overtime to beat Notre Dame two years ago, pulled another play out of his bag of tricks at the right time.

The Wolverines were completely fooled when punter Mike Sadler took a snap from the Michigan State 23 on a fourth-and-9 and ran to the right, all alone, on a 26-yard gain that set up a go-ahead field goal.

That play, though, was not enough to beat Michigan.

The Wolverines led 6-0 at halftime.

In the first half, Robinson was held to just 17 yards rushing on 12 carries, and his longest went for 5 yards.

He was 8 of 13 for 108 yards in the first half, connecting on a 22- and 15-yard passes to Dileo to set up Gibbons' 24-yard field goal early in the second quarter and a 35-yarder to Dileo that led to Gibbons' 48-yard kick late in the first half.

Behind an already banged-up offensive line that lost left tackle Dan France to a concussion in practice this week, the Spartans were sluggish with the ball in the first half as they have been often this season.

Bell ran for just 31 yards on 11 carries and Maxwell was 10 of 16 for 96 yards in the first half.

Maxwell threw a 45-yard pass to Bennie Fowler to get into position to kick a game-tying field goal midway through the second half, but Conroy missed his sixth field goal of the season — from 38 yards.

The Spartans started to click on offense on their first possession of the second half, picking up four first downs — matching their total from the first half — on four straight plays and a broken trick play set up the game's first TD.

Michigan State wide receiver Tony Lippett got the ball on a reverse that was designed for him to pass and he ended up keeping the ball, eluding three defenders that could've dropped him for a loss, for a 10-yard run that set up Maxwell's TD pass to Lang.

The Spartans had a chance to add to their lead late in the third, but Maxwell overthrew an intended receiver and safety Kovacs took advantage with a key interception.

Michigan then had two chances to score a go-ahead TD, but safety Isaiah Lewis broke up a pass in the end zone intended for Devin Funchess and Robinson missed wide-open teammate Jeremy Gallon and the Wolverines had to settle for a FG and a 9-7 lead early in the fourth quarter.

The Wolverines, though, didn't miss on their opportunity to win a game they — and their fans — desperately wanted against a team they've had their way with most of the time for more than 100 years.