SAN DIEGO (AP) -- No. 19 Stanford was already on its heels against San Diego State when aging San Diego Stadium plunged into darkness.
After the lights flickered back on, the Aztecs scored a signature win to leave their Pac-12 foe in the dark.
Christian Chapman threw an 8-yard touchdown pass to tight end David Wells with 54 seconds left, capping a wild ending sparked by a darkness delay in San Diego State's 20-17 victory Saturday night.
Six plays before Wells' score, the game was delayed nearly 25 minutes when most of the lights suddenly went out at what used to be known as Qualcomm Stadium. The city has fallen behind on maintenance of the 50-year-old stadium, and the NFL's Chargers moved to Los Angeles earlier this year after they couldn't get a deal for a new home.
The game resumed with the Aztecs on the Stanford 42, and SDSU quickly moved in for the score. On the winner, Chapman rolled right and found Wells, who slammed into Brandon Simmons and tumbled into the end zone.
"I was hoping my number would get called," Wells said. "I thought to myself before the play, `There's no way I'm not getting into this end zone. It was a willpower thing.'
The delay didn't hurt SDSU (3-0), which beat a nationally ranked nonconference opponent for the first time since 1981.
After the lights went out, thousands of fans shined lights from their cellphones.
"I was saying it was the calm before the storm-type thing," Chapman said. "We're all in there, we were telling each other, `This this is it.' I mean, crazy can't write it any better. The lights shut off, you're in the stadium, everyone's showing their lights, the fans are going crazy."
Stanford coach David Shaw said he didn't think the delay affected Stanford's defense.
"If anything, San Diego State had the momentum," he said. "They'd just gotten an explosive play, they got a big play before the lights went out."
He said the officials did a good job of keeping the teams informed of what was going on, and that "our guys were ready to go."
Kameron Kelly intercepted Keller Chryst on the first play of the ensuing Stanford possession.
As the clock ran down, thousands of SDSU fans rushed the field.
The comeback by SDSU (3-0) overshadowed a huge night by Stanford's Bryce Love. He gained 184 yards on just 13 carries, including touchdown runs of 53 and 51 yards, plus a 47-yarder that set up a field goal.
Love's 53-yard scoring run came on the first play of the fourth quarter, giving Stanford a 17-13 lead.
Stanford fell to 1-2.
Aztecs running back Rashaad Penny, the national rushing leader, had 175 yards on 32 carries, including a 4-yard touchdown run. He came in leading FBS in rushing yards per game (206.5) and all-purpose yards per game (284). He went off for 353 all-purpose yards in a win at Arizona State, including scoring on a 95-yard run, a 99-yard kickoff return and a 33-yard reception.
"This is a game we all wanted," Penny said. "Like I said, this was an opportunity game. And we took this game. To us, we're not surprised. We're just a San Diego State team trying to win, and win championships."
After an early defensive struggle, Stanford broke through first when Love ran 51 yards for a touchdown early in the second half for a 7-3 lead.
SDSU gained momentum with two big stops just before halftime.
Ron Smith intercepted Chryst and returned it to the 15. Penny scored three plays later for a 10-7 lead. He emphatically spiked the ball, drawing an unsportsmanlike conduct flag.
Stanford drove to the SDSU 25 before Chryst lost the ball on a strip sack by Kelly, with Damon Moore recovering with 17 seconds left in the half.
"I didn't prepare the team well enough," Shaw said. "This is a really good football team. I hope we didn't take them lightly but I didn't do a good job of getting us ready to play a very good, very physical football team that not only runs the ball, but has a quarterback that does a bunch of different things."
STANFORD: The Cardinal had two lousy weekends in Southern California. A week earlier, Stanford lost 42-24 to USC in its Pac-12 opener, in which it allowed 307 yards rushing.
SAN DIEGO STATE:The Aztecs of the Mountain West Conference could pop back into The Associated Press Top 25, which is where they ended last season. They have beaten a Pac-12 team for the third straight time, and for the second time in two weeks. They won 30-20 at Arizona State a week earlier to snap a 28-game road losing streak to Pac-12 schools. They beat California 45-40 here last season.
STANFORD: The Cardinal return to Pac-12 action when it hosts UCLA on Saturday night.
SAN DIEGO STATE:The two-time defending MWC champion Aztecs open league play at Air Force on Saturday.