The Horned Frogs had taken a 16-14 lead only 1 1/2 minutes earlier on Jaden Oberkrom's 53-yarder, but Connor Cook drove the Spartans (7-6) 45 yards on eight plays with time winding down to set up the decisive kick.
Le'veon Bell amassed 145 rushing yards with a touchdown on 32 carries as Michigan State won despite managing just 227 yards of total offense.
The Spartans took their first lead of the game with 7 minutes left when Bell scored on a 4-yard run following a fumbled punt by TCU's Skye Dawson.
Trevone Boykin went 13-of-29 through the air for 201 yards and an interception while also rushing 13 times for 37 yards for the Horned Frogs (7-6).
Josh Boyce made five catches for 91 yards for TCU.