EAST LANSING, Mich. -- Michigan State desperately needed a big play to avoid an upset and Felton Davis delivered.
Davis made a fully extended, 31-yard catch to help set up Connor Heyward's second touchdown with 2 minutes left to put the 11th-ranked Spartans ahead and they held on to beat Utah State 38-31 on Friday night.
Michigan State's high hopes for the season looked as if they might get dashed with 5:05 left in the opener for both teams after Darwin Thompson put the Aggies ahead with a 1-yard run, his second go-ahead score.
On perhaps the pivotal play of the game, Brian Lewerke dropped back, spun to his left and heaved a pass on a second-and-7 from midfield that Davis dove to catch.
"Insane," Lewerke said.
Four snaps later, Heyward scored on a 13-yard run as Utah State's defense failed to make one more stop to beat the highest-ranked team in school history, surpassing the victory over No. 18 BYU in 2014.
Utah State did have one more chance to send the game to overtime -- or possibly pull off the upset -- but linebacker Joe Bachie tipped and intercepted a pass at midfield with 1:15 remaining.
"We were playing to win," Aggies coach Matt Wells said. "If we would have scored, we would have gone for 2."
The Spartans trailed until the second quarter, built a 13-point lead late in the third and fell behind late in the opener for both teams.
"Over the course of our program, we've won a lot of close games," Michigan State coach Mark Dantonio said. "We certainly make it interesting. I wish we wouldn't."
Michigan State's Brian Lewerke was 23 of 33 for 287 yards with two TDs, including a go-ahead, 10-yard TD pass to Davis with 28 second left in the first half. Lewerke also threw an interception and lost a fumble. He threw an 8-yard TD pass to Cody White with 10:49 left in the first half, giving the Spartans their first lead after a sluggish start.
"It took a little bit to get going," Lewerke acknowledged.
Jordan Love capped the opening, 75-yard drive with a 1-yard run and completed 29 of 44 passes for 319 yards with two interceptions for the Aggies, who went home proud of their performance.
"It shows we've got a good team," he said. "We just came up short."
Heyward's first career rushing score was on a 17-yard TD in the third, which put Michigan State up 27-14. He is the son of the late Craig "Ironhead" Heyward, an NFL running back from 1988-1998. The sophomore ran for 436 yards on kickoff returns, had a combined 23 yards rushing and receiving and had one TD reception last season.
LJ Scott ran for 84 yards on 23 carries and had 57 yards receiving on three catches for the Spartans.
Utah State: Wells helped the Aggies earn a bowl bid last year for the sixth time and in seven seasons and they seem to have a shot at playing in the postseason again. Their no-huddle, hurry-up offense is going to be a problem for some teams. On defense, they can pressure quarterbacks and make plays in the secondary. They also have experience with eight starters back on both sides of the ball.
"We will take some confidence going out of this game," Wells said. "That's a very good football team and a program that's been consistent for a long, long time. I have a lot of respect for them and the way coach Dantonio has done it kind of watching from afar. To be able to play the way we did and have a chance to win at the end, I'm proud of our guys.
"Don't misconstrue that to say that that was a moral victory or anything like that.
Michigan State: Dantonio will have plenty of teachable moments to show the Spartans on film. They were able to overcome a sloppy game with nine penalties against a Mountain West Conference program, but may not be as fortunate against Big Ten competition.
"We have a lot of things to clean up," said safety Khari Willis, who had an interception.
Michigan State made mental and physical mistakes that led to penalties, settling for field goals twice after driving to the Utah State 1 twice.
"We can't do that in this conference," co-offensive coordinator Dave Warner said.
The Spartans could slip due to the lackluster performance, especially if teams just ahead and behind them in the poll open with a win.
Michigan State won its 20th straight home opener, dating to its 23-16 loss as the 23rd-ranked team to No. 15 Colorado State in 1998 during Nick Saban's fourth of five seasons. The Spartans have not started the season with a loss at home to an unranked team since losing to Central Michigan in 1991.
ON THE MOVE
The Aggies' no-huddle offense created problems for Michigan State, which tried to substitute players in and out of the game on defense during drives.
"We had to stop doing that," defensive coordinator Mike Tressel said.
Utah State: Host New Mexico State on Sept. 8.
Michigan State: At Arizona State on Sept. 8.
More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25
NCAA denies extra year to AAC's reigning DPOY
East Carolina defensive end Nate Harvey's appeal for an additional year of eligibility has been rejected by the NCAA.
USC's Swann 'blindsided' by admissions scandal
Lynn Swann said in an interview with the Los Angeles Times that he doesn't plan to resign his job as Trojans athletic director in the aftermath of the college admissions bribery scandal that has roiled many of the nation's top schools, including USC.
Texas icon, ex-NFL WR Johnny 'Lam' Jones dies
Former Texas football and track star and NFL receiver Johnny "Lam" Jones has died at age 60.
Clemson lands another coveted OL recruit for '20
Clemson landed its second ESPN Junior 300 offensive lineman in three days when Bryn Tucker announced his commitment to the Tigers on Thursday.
The most dynamic game-breaker on each Top 25 team
Who will be the most electric players for the nation's top teams this season? Clemson and Alabama have an embarrassment of riches on offense, but they're not the only ones.
Murray impresses scouts, coaches at Pro Day
Todd McShay and Tim Hasselbeck break down Kyler Murray's exceptional workout at Oklahoma's Pro Day.