TEMPE, Ariz. -- Arizona State coach Todd Graham had only one reaction when his team's second straight shaky performance ended this time with a win: Whew!
There was really no other response, logically or emotionally.
Mike Bercovici threw two of his three touchdown passes in the fourth quarter and Arizona State avoided a huge upset in its home opener by holding off Cal Poly 35-21 Saturday night.
More from FoxSports
"Games like that are catastrophic if they go the other way," Graham said.
It nearly did.
The Sun Devils (1-1) were flat in an opening loss to Texas A&M and had a hard time shaking the FCS Mustangs in their first game at renovated Sun Devil Stadium.
Demario Richard ran for 121 yards and two touchdowns, but Arizona State had a pair of key turnovers and struggled in the red zone in the second half.
The Sun Devils had all kinds of trouble with their assignments while trying to stop Cal Poly's triple option, allowing the Mustangs to repeatedly pound the ball up the middle.
The special teams had a few miscues, though none as glaring as last week.
Arizona State finally pulled away in the final eight minutes, when Bercovici hit Kody Kohl on a 10-yard touchdown midway and put the game away with a 4-yard pass to Tim White.
"We need to look at the mistakes we made and learn from them," said Bercovici, who threw for 283 yards.
Cal Poly (1-1) opened the season by knocking off two-time FCS national champion Montana 20-19 on a last-second field goal and didn't back down in its first game against a Pac-12 team.
Attacking the Sun Devils up the middle with their triple option, the Mustangs ran through Arizona State for 284 yards. Joe Protheroe had 130 yards and a touchdown.
"Anytime you lose you are going to have some moments but I couldn't be any prouder how hard we played," Cal Poly coach Tim Walsh said. "I really thought we were going to win the game. I believed it and our players believed it."
Cal Poly doesn't exactly have the same speedy defensive ends as Texas A&M -- few teams do -- so Bercovici had more time and Arizona State's offense clicked in first half.
The Sun Devils had 282 total yards by halftime, nine fewer than the entire Texas A&M game, and scored more points (21) than the opener after Richard scored on runs of 13 and 6 yards.
The only first-half blemish was a big one: Kohl lost a fumble to set up a Cal Poly touchdown and the Mustangs used the momentum to score another.
"The (end of the) second quarter was just chaos," Graham said.
Arizona State continued to move the ball in the second half, twice moving inside Cal Poly's 10, but got nothing out of it.
A 1-yard touchdown run by Richard on the opening drive was overturned on review and Bercovici threw an interception in the end zone on fourth-and-goal. A drive early in the fourth quarter ended when Zane Gonzalez missed a 28-yard field goal.
The Sun Devils finally capitalized in the red zone midway through the fourth quarter, when Kohl wrestled the ball away from Cal Poly safety B.J. Nard for a 10-yard touchdown that put Arizona State up 28-21. White put the game away with his touchdown catch with less than two minutes left.
Arizona State's defense had its own struggles.
Instead of giving up big plays like against Texas A&M, the Sun Devils took a series of gut punches from the Mustangs' triple option.
Attacking with the dive option, Cal Poly ran right up the middle against Arizona State's defense, setting up a 4-yard touchdown run by Protheroe and a 1-yard scoring dive by Chris Brown in the first half.
The Mustangs switched things up to open the second half, working more to the outside and Brown completed his first pass of the game -- on his second attempt -- for a 21-yard touchdown to Reagan Enger that tied the game at 21-all.
Arizona State tightened up after that, though, forcing four straight punts.
"We played our best football for the first 52 minutes and our worst football the last eight minutes," Walsh said. "Coming from our level and who we are, we have to play 60 great minutes to beat a football team like that."