Stanford cornerback Wayne Lyons almost intercepts a pass intended for Southern California wide receiver Nelson Agholor during the first half of Saturday’s game in Los Angeles.

LOS ANGELES — Andre Heidari kicked a 47-yard field goal with 19 seconds to play, and Southern California’s stalwart defense repeatedly came up big in a 20-17 victory over No. 5 Stanford on Saturday night.

Cody Kessler passed for 288 yards for the revitalized Trojans (8-3, 5-2 Pac-12), who earned their fifth win in six games under interim coach Ed Orgeron.

USC’s remarkable defensive performance included two fourth-quarter interceptions against the powerful Cardinal (8-2, 6-2), who followed up last week’s win over Oregon by getting knocked out of the national title chase and maybe the Rose Bowl race as well.

After the inconsistent Heidari’s field goal and Stanford’s final play, USC fans stormed the Coliseum field, where Stanford had won in its last three trips.

Heidari nearly lost his job twice this season, and he missed an extra point in the first quarter. But the junior coolly nailed the tiebreaking field goal — and then got an unsportsmanlike conduct penalty for running the length of the field to celebrate it.

Soma Vainuku caught an early TD pass and Javorius Allen rushed for a score for USC, which didn’t score in the second half until Heidari’s kick. Nelson Agholor had eight catches for 104 yards, while Marqise Lee had six catches for 83 yards — and both receivers made big plays on USC’s final drive.

Tyler Gaffney rushed for 158 yards and two touchdowns for Stanford. Kevin Hogan went 14 of 25 for 127 yards, but the Cardinal couldn’t regain the lead after trailing at half, despite repeatedly getting close.

After trailing 17-10 at halftime, Stanford calmly tied it with Gaffney’s 18-yard TD run on the first drive of the third quarter. USC’s offense struggled throughout the second half, but the Trojans’ thin defense kept it close despite using just two substitutes for most of the night.

Dion Bailey intercepted Hogan’s third-down pass at the USC 6 with about 10½ minutes to play, killing what seemed certain to be Stanford’s go-ahead drive. Su’a Cravens then intercepted a tipped pass at the USC 44 with 3 minutes to play, giving another chance to the Trojans’ offense.

After Lee caught a 13-yard slant pass over midfield on fourth-and-2, the Trojans reached the Stanford 21 before two straight yardage-losing plays pushed them back to the 30 — and Heidari still nailed his kick.

Under the lights at the sold-out Coliseum, Stanford betrayed a few nerves early. The Cardinal burned two timeouts and committed an illegal-snap penalty on the game’s first drive, and Ty Montgomery dropped two passes in the opening minutes.

USC’s opening drive was smooth, with Lee making a tiptoe sideline catch before Vainuku came out of the backfield for a play-action 1-yard TD catch just 6:13 in.

Gaffney scored on a 35-yard run moments later when he popped out the back of a scrimmage pile and sprinted past the slumbering USC defense, but the Trojans answered with another long drive capped by Allen’s 1-yard TD run and a 2-point conversion catch by Lee.

Kessler was outstanding in the pocket and on the run, completing 10 straight early passes before Heidari’s field goal put the Trojans up by 10 points early in the second quarter. Stanford added a field goal with 17 seconds left the first half.

After Gaffney capped a 92-yard drive with his TD run up the middle, Stanford forced a fumble by Kessler at the USC 19, but the Cardinal’s field goal attempt was blocked.

Stanford is USC’s oldest rival in a series dating back to 1905. The Cardinal had never won four straight in the series before the last four meetings.

Former Stanford lineman Jonathan Martin watched the game from the sideline in a backward Cardinal cap.

BAYLOR 63, TEXAS TECH 34

ARLINGTON, Texas — Bryce Petty threw three touchdown passes and ran for two more as No. 4 Baylor stayed undefeated, overcoming its first double-digit deficit of the season in a 63-34 victory over Texas Tech on Saturday night.

The Bears (9-0, 6-0), even without several key offensive players, stretched their school-record winning streak to 13 games. They are the outright Big 12 leader after No. 23 Texas absorbed its first conference loss earlier in the day, and are one of six undefeated FBS teams.

Shock Linwood, effectively the Bears’ third-string running back, ran 29 times for 187 yards and a touchdown while Devin Chafin, another redshirt freshman, had 11 carries for 100 yards and two TDs. Levi Norwood had TD catches of 40 and 58 yards, and also returned a punt 58 yards for a score.

Texas Tech (7-4, 4-4) lost its fourth straight game since a 7-0 start for first-year coach Kliff Kingsbury, who was the Red Raiders’ starting quarterback when Baylor coach Art Briles was the running backs coach at Tech from 2000-02.

Baylor played its first game since Briles this week got a new 10-year contract through the 2023 season, and was down 14-0 after 8 minutes before getting on a roll. The coach is in his sixth season with the Bears, who had 12 consecutive losing seasons since the inception of the Big 12 when he arrived.

Next week, the Bears play at No. 12 Oklahoma State (9-1, 6-1), which won 38-13 at Texas hours earlier.

And they have a chance to move a spot in the new BCS standings on Sunday. The Bears were fifth last week, behind Stanford — which lost for the second time this season, 20-17 to Southern California on Saturday night.

Baylor played without its top two running backs, Big 12 rushing leader Lache Seastrunk (groin) and Glasco Martin (knee), and 103-yard-a-game receiver Tevin Reese. All got banged up in the Bears’ 41-12 win over Oklahoma nine nights earlier, Reese the most serious with a dislocated right wrist that required surgery and will force him to miss at least the rest of the regular season.

The Bears still surpassed their FBS-best scoring average of 61 points that was already on pace to break a major college scoring record. They had 675 total yards, only 11 below their nation’s best average.

Petty was 17-of-31 passing for 335 yards, and put Baylor ahead to stay when he hit wide-open Antwan Goodley for a 31-yard TD pass and a 21-20 lead with 4 seconds left in the first quarter. Goodley’s Big 12-best 11th TD catch came immediately after K.J. Morton intercepted a pass.

Baker Mayfield, starting as Tech’s quarterback for the first time since its fifth game, completed 28 of 51 passes for 314 yards and four touchdowns. His only pick came when he threw a pass right into the chest of the leaping Morton.

Bears kicker Aaron Jones became the NCAA career leader for extra points with nine more, pushing his career mark to 260. The previous record was the 253 by Art Carmody of Louisville from 2004-07, which Jones passed with his three in the first quarter. Jones has made 175 in a row, the NCAA’s longest active streak.

Texas Tech led 14-0 after standout tight end Jace Amaro had touchdown catches on the Red Raiders’ first two drives. There was a 6-yard TD on a halfback pass from Kenny Williams on the 15th play of a game-opening 75-yard drive before Amaro got wide open for a 20-yard score from Mayfield the next time they had the ball.

Amaro took a crushing hit from Ahmad Dixon while holding on for an 18-yard catch to the 4, two plays before Mayfield’s 3-yard TD to Jakeem Grant with 4:28 left in the first half got the Red Raiders within 28-27.

After staying down on the field for several minutes, Amaro got up and walked to the sideline on his own power, though slowly. He did get back in the game, but didn’t have another catch. He finished with four catches for 55 yards.

The South Carolina coach and all 83,853 people at jam-packed Williams-Brice Stadium watched the final dramatic moments of No. 7 Auburn’s 43-38 victory over No. 25 Georgia on the 124-foot tall video board that kept the Gamecocks in the race for a Southeastern Conference title.

Then Spurrier watched his team rally in the second half behind Elliott Fry’s field goals to overcome Florida’s SEC-leading defense for a 19-14 victory, setting a school record with its 16th straight home win.

“What a game that was, good gracious. Sort of a Hail Mary ball, ricocheting around, he caught it,” Spurrier said of Auburn’s tipped-ball touchdown. “I guess that’s why people watch football on television for games like they had. Ours was pretty interesting, too.”

Now, South Carolina (8-2, 6-2) will cross its fingers and hope that SEC East leader Missouri stumbles at Ole Miss next Saturday or against Johnny Manziel and Texas A&M on Nov. 30 to send the Gamecocks to their second SEC title game since 2010.

South Carolina finishes with FCS opponent Coastal Carolina and rival Clemson at home, attempting to build on its school-record 16-game home win streak

“Maybe something bigger’s going to happen for us down the road, I don’t know,” Spurrier said. “We’ll watch Missouri from a distance and get ready for Coastal (Carolina.)”

Fry made field goals of 25, 45, 22 and 43 yards. Bruce Ellington had the Gamecocks’ lone touchdown, a 32-yard grab from Connor Shaw on fourth down to cut Florida’s 14-6 halftime lead to one point.

South Carolina’s defense, scorched by the Florida run game in the opening half, tightened up in the second half to send the Gators to their fifth straight loss, their longest such streak since losing nine in a row during the 0-10-1 debacle of 1979.

The Gamecocks (8-2, 6-2 Southeastern Conference) struggled to score points against the Gators’ SEC-leading defense until Fry gave them a 16-14 lead with a 22-yard field goal with 6:43 remaining.

Trailing 19-14, Gators freshman quarterback Skyler Mornhinweg led the Gators into South Carolina territory but was intercepted by Jimmy Legree to end the threat.The Gamecocks’ win surpassed the 15 straight the program won at home from 1978-80 when Heisman Trophy winner George Rogers was leading the way. South Carolina’s 16 straight in its home stadium is longest current streak in the country.

But Florida sure looked ready to end it the way it played in the first half. Without injured starting quarterback Tyler Murphy, the Gators successfully went to the run. They ran for 169 yards in the opening half and Kelvin Taylor had rushing TDs of 20 and 29 yards, the two longest permitted by South Carolina this season.

The Gamecocks defense tightened up in a big way in the second half as Florida managed just 31 rushing yards.

South Carolina’s rally began on Shaw’s 32-yard scoring pass to Bruce Ellington to cut the lead to 14-13 before Fry’s two fourth-quarter field goals provided the final margin.

Florida had its chances. The Gators to South Carolina’s 8 after the Gamecocks’ touchdown, yet Austin Hardin missed a 32-yard field goal.

Florida tried a fake punt play on fourth-and-13 and trailing 16-14, but Trey Burton’s pass to defensive lineman Leon Orr was knocked away with 4:40 remaining.

Shon Carson ran for 102 yards, including a 58-yard burst on South Carolina’s drive that led to Fry’s go-ahead field goal.

Murphy’s sore shoulder kept him from the field despite rehabbing throughout the week. The Gators were also minus starting cornerback Marcus Roberson, who the team said was suspended for violating team rules.

Still, Florida’s defense and made life miserable for Shaw, SEC leading rusher Mike Davis and the Gamecocks.

South Carolina had first-and-goal on the 5 on its opening drive, yet settled for Fry’s 25-yard field goal. The Gamecocks were deep in Florida territory the next time they had the ball and again were held to a field goal.

Florida came in last in overall offense and next-to-last in rushing at 146 yards a game on the ground this season. But Taylor and Mack Brown burst through several open holes as the Gators put up 169 yards rushing in the first half.

Florida did its best not to overwhelm Mornhinweg, whose father Marty is the offensive coordinator of the New York Jets, in his first college action. Burton, a receiver, ran the wildcat formation and the Gators ran 22 of 24 plays.

Mornhinweg was 10 of 13 for 107 yards with an interception.

Davis, who came in with 1,058 yards, ran for just 58 — his second fewest in a game this season.

The loss put a capper on a tumultuous week for Florida. Coach Will Muschamp received support from athletic director Jeremy Foley and university President Bernie Machen against program critics. The Gators will have to win their final two games against Georgia Southern and No. 2 Florida State or they’ll miss the postseason for the first time since 1990 when NCAA issues held them back.

“We have a lot of negativity out there and these guys pulled together and showed what those guys are about,” said Muschamp, who had the fingers bandaged and bloodied on his right hand after hitting a chalk board in frustration. “We needed to make some plays. The bottom is winning and we didn’t do it. That’s on me.”