Cousins threw a 33-yarder to Cunningham in the third quarter and hit him again on a juggling 29-yard TD pass with 5:17 left to complete a 93-yard drive. It was the 62nd career touchdown pass for Cousins, breaking the school record held by Jeff Smoker (61).
Northwestern (6-6, 3-5) had its four-game winning streak snapped in the regular-season finale and now hopes for a bowl bid. The Wildcats closed to 24-17 early in the final quarter on Dan Persa's 12-yard TD pass to Demetrius Fields, set up by a clutch fourth-down pass from Persa to Jeremy Ebert.
The Wildcats got the ball back at the MSU 47, but a holding penalty and Jerel Worthy's sack of Persa forced a punt and then MSU went on its long, game-clinching drive.
Martin sprinted in on his 57-yard punt return with 34 seconds left in the half as Michigan State scored two touchdowns in the final 1:40 of the second quarter and took a 17-3 lead at the intermission.
With the score tied at 3-3, Northwestern was driving when Treyvon Green fumbled after a hit by Max Bullough and Michigan State's Denzel Drone recovered at the Spartan 3 with just more than five minutes left in the half. Northwestern called a timeout - presumably to have the play reviewed - but Michigan State retained possession.
MSU then took off on a 97-yard drive - Cousins hit Brian Linthicum for 15 yards and heaved a 46-yarder to Martin that carried to the NU 7. Le'Veon Bell then carried the final 7 yards for a TD, completing an eight-play march that put the Spartans up 10-3.
The Spartans defense then forced a Northwestern punt and Martin fielded Brandon Williams' boot, broke to his right, signaled to blockers and sailed in for a 17-3 lead. The two TDs came just 66 seconds apart.
Northwestern responded quickly once the second half began.
The Wildcats' Drake Dunsmore got wide open on a blown coverage, hauled in a Persa pass and raced downfield on a 69-yard play before he knocked out at the 3. One play later, Persa flipped a 2-yard TD to Jeremy Ebert and two minutes into the third quarter, Northwestern was back in the game at 17-10.
But Cousins had a third-down keeper of 8 yards for a first down to keep the Spartans moving. And then on a third-and-13 he rolled out and avoided the rush before making a beautiful throw to Cunningham for a 33-yard TD that made it 24-10.
Cousins completed 14 of 20 for 214 yards on a drizzly overcast day and Cunningham had six catches for 120 yards. Michigan State's league-leading defense came up with six sacks. Persa completed 23 of 32 for 245 yards and two TDs.