SANTA CLARA, Calif. (AP) — With the Pac-12 championship hanging in the balance, Southern California delivered a goal-line stand followed by a 99-yard drive that gave the Trojans their first conference title in nine years.

Sam Darnold’s 54-yard pass to Michael Pittman Jr. keyed the long drive after Uchenna Nwosu preserved the lead with the defensive stop that led No. 9 USC to a 31-28 victory over No. 15 Stanford on Friday night.

“It was time to dig deep and win a championship,” coach Clay Helton said. “When you’re trying to win one, those are the plays that are going to define you and define your football team.”

The Trojans (11-2, No. 10 CFP) led 24-21 when the Cardinal (9-4, No. 12) drove down the field in position to tie the game or take the lead.

But facing a third down from the 2, Stanford kept star back Bryce Love on the sideline with his gimpy ankle to rely on short-yardage back Cameron Scarlett instead. Scarlett ran on successive plays, gaining 1 yard on third down and then being stopped just short of the end zone on fourth.

“The bottom line is we had opportunities and we didn’t make enough plays,” coach David Shaw said. “We made enough plays to keep it close but not enough plays to win. The sequence of fourth-and-1 to take the lead in the Pac-12 championship game, there’s no hesitation at all. That’s what we’re going to do.”

Shaw figured at worst, Stanford would come out of that situation with a defensive stop and good field position on the ensuing drive but those hopes ended when Darnold delivered the offensive play of the game.

After Ronald Jones gained 1 yard on first down, Darnold dropped back to pass and quickly was under pressure. He stepped up and appeared ready to run before launching a pass to Pittman to get USC out of trouble.

“That’s kind of what you expect from Sam, to make those crazy plays,” Pittman said. “That’s why he’s one of the best players in the country.”

Jones finished that drive with an 8-yard run that made it 31-21 to cap a productive night where he ran for 140 yards and two touchdowns to give USC its first Pac-12 title since 2008.

Darnold was 17-for-24 for 325 yards with TD passes to Pittman and Tyler Vaughns to lead the way for USC.

The win gives USC a season sweep against…