SAN JOSE, Calif. -- Derek Carr finally ran into a quarterback who could match his prolific production. That's all it took to end Fresno State's bid for a BCS bowl.

David Fales threw for a school-record 547 yards and six touchdowns in an entertaining showdown with Carr and San Jose State spoiled the 16th-ranked Bulldogs perfect season with a 62-52 victory Friday.

"It's hard," Carr said. "Guys are torn up, as well they should be. If you like losing there's something wrong with you."

Fales was every bit as good as the more heralded Carr, matching his six first-half touchdown passes in a near perfect performance that made the Spartans (6-6, 4-4 Mountain West) bowl eligible with their first win over a ranked opponent since 2000.

Carr threw for 519 yards and six touchdowns, but also had a fourth-quarter interception for the Bulldogs (10-1, 7-1). Davante Adams caught 13 passes for 264 yards and three scores.

The loss ended Fresno State's chances to beat out Northern Illinois for a spot in a prestigious BCS game. The Huskies are the only undefeated team from a non-automatic qualifying conference.

"We wanted it bad," Carr said. "If you don't want do your very best, to play in a BCS bowl game then you shouldn't be playing college football. That's what you want to do but it's so hard to do."

The Bulldogs will still play in the Mountain West title game next week against either Utah State or Boise State but had their chances at a big bowl payoff done in by a porous defense.

"When your offense scores 40, 50 points you should never lose a game," safety Derron Smith said. "I feel like the defense didn't do a good enough job and let the team down

Fales had his pick of targets with freshman Tyler Winston catching 10 passes for 164 yards and a score, Kyle Nunn having 10 for 160 yards and two touchdowns and Chandler Jones finishing with eight for 146 yards and three TDs.

"Our receivers were making good plays," Fales said. "Playing an offense like that, field goals weren't going to win the game. We needed touchdowns."

That entertaining performance has the Spartans hopeful of making a bowl game in consecutive seasons for the first time since 1986-87. The Mountain West has six bowl slots but could have eight eligible teams if Colorado State and Wyoming win Saturday.

After a back-and-forth first half that ended with San Jose State on top 42-41, Spartans coached Ron Caragher made a bold move to open the second half with a surprise onside kick. Kicker Harrison Waid chased down the slow roller and recovered it even though Fresno State's warned the players about the possibility. The Spartans turned that extra possession into a 7-yard touchdown run by Thomas Tucker.

"The way things were going, it becomes a matter of possessions with two offenses that were constantly scoring," coach Ron Caragher said. "It was executed to perfection. A huge thing to gain this extra possession."

The teams then traded field goals, and then Fales drove the Spartans to their eighth touchdown on his 1-yard keeper that made it 59-44.

Keith Smith helped seal the win with a leaping interception, ending Carr's streak of 305 straight passes without throwing a pick. That set up a second field goal by Austin Lopez that made it 62-44 and led to chants of "Over-rated! Over-rated!" from the crowd.

"Put the blame on me for the offense," Carr said. "You guys want to praise me when it's good -- Heisman this and all this. Blame me for the loss. I need to do a better job to help my team win."

The tone for the game was set immediately. Fales set the school record for career completions on the fourth play when he found Winston for a 33-yard gain. Two plays later, Nunn leaped over Curtis Riley to come down with a 31-yard score.

Carr took two plays to match that score, connecting on a 46-yard deep ball to Adams on the first play followed by a 27-yard touchdown to Josh Harper, who left the game with an injured left leg after an impressive one-handed grab in the end zone.

Christian Tago blocked the extra point attempt. That proved to be the difference at the end of a first half that featured 12 touchdowns and 1,006 yards of combined offense as the defenses had no answers for the future pro passers and their collection of talented receivers.

Fresno State appeared in position to take the lead into halftime when Carr threaded a 21-yard touchdown pass to Isaiah Burse with 1:43 remaining. But Fales quickly drove the Spartans to the go-ahead score on his 19-yard throw to Jones with 18 seconds left to make it 42-41.

Even that lead wasn't safe as Carr completed two passes to move the ball past midfield and Adams nearly came down with a Hail Mary.