LOS ANGELES (AP) — Stanford was playing with a spring in its step Saturday, skipping into the halftime break with a 20-point lead after five points in a 10-second stretch before the buzzer.

It ended up being the best thing that could have happened — to Southern California.

Oneyka Okongwu scored 22 points and Elijah Weaver hit a clutch 3-pointer to force overtime as USC rallied from a 21-point second-half deficit to earn an 82-78 victory on Saturday.

Stanford’s late first-half scoring outburst prompted a team admonishing by USC head coach Andy Enfield that was probably coming even if Stanford didn’t get a Jaiden Delaire layup with 10 seconds remaining in the first half and a 3-pointer from Tyrell Terry with one second on the clock.

Enfield’s halftime intensity transferred to his team’s defensive effort in the second half, which ended up making the offense click as the Trojans figured out a way to overcome the Cardinal.

USC trailed 46-25 early in the second half. The Trojans chased down the Cardinal over the next 19 minutes. They owned the extra period. Enfield supplied the fuel.

“After the halftime speech we got from coach, it was time to lock in and play,” Weaver said. “One hundred percent that’s what it was; it was our defense.”

What did Enfield say exactly? Weaver smiled, suggesting it was probably best left behind closed doors. Whatever it was, it worked.

“I used my dad’s deep voice at halftime,” Enfield said. “I yelled very loud and they responded. We beat a very good team. We came out with energy. We had missed so many close shots in the first half and they made shots. Some of the first half was them, but a lot was us.”

Weaver continued to deliver for the Trojans in overtime, scoring eight of his team’s 13 points. He finished with 13. His 3-pointer at the regulation buzzer was his only make from distance in five attempts.

USC trailed 69-64 with 33 seconds remaining in regulation after Stanford’s Lukas Kisunas made a layup. The Trojans took over from there.

Okongwu made a layup with 11 seconds remaining, and after a Daejon Davis turnover on the inbound pass, Weaver hit his off-balance 3-pointer while getting fouled by Davis on the play. Weaver missed his free throw that would have given the Trojans the lead.

Despite the free-throw miss, Weaver remained confident in the extra period.

“Just have a short memory and keep playing,” Weaver said, acknowledging that the victory tied USC atop the Pac-12 with Stanford. “We’ll take this game for what it is, a big win, and build off of it. Being No. 1 in anything is big.”

Jonah Mathews scored 19 points and Ethan Anderson added 11 as the Trojans (15-3, 4-1 Pac-12 Conference) won for the ninth time in their past 10 games and improved to 2-0 at home in conference play and 8-1 in their own building this season.

“They did a nice job, made some adjustments and got our offense to slow down a little bit,” Stanford head coach Jerod Haase said. “Defense rebounding is always important for us, and that was a weakness in that second half. We gotta give them credit.”

Stanford lost for just the second time in its past 10 games with the other defeat to No. 5 Kansas at home.

Okongwu added nine rebounds for the Trojans, who had a 38-31 advantage on the boards.

The Cardinal dominated the first half, closing it on a 7-0 run to take a 45-25 lead into the break. Stanford was and 6 of 10 from 3-point range in the opening 20 minutes.

“In the first half, we didn’t play smart or together,” Okongwu said. “After halftime, we played with more heart. We all had the same mindset, play harder, smarter and with more toughness.”

The Trojans made their move early in the second half with a 15-2 run to cut the deficit to single digits at 48-40. But a 9-2 Stanford run, capped by a 3-pointer from Spencer Jones, put Stanford back up 57-42 midway through the second half.

Another USC run, this one a 12-1 advantage got the Trojans to within 60-56 with 6:25 remaining. They were able to get within 62-60 on a layup by Anderson with 4:47 remaining and refused to go away with a pressure defense that forced 17 turnovers.

Stanford shot 49% from the field to 40% for USC and they still lost. It was the first time in four games the Trojans won a game while getting outshot by their opponent.

BIG PICTURE

Stanford: In a tale of two halves in regulation, the Cardinal shot 65.5% from the field in the opening 20 minutes and just 34.8% after halftime. … The Cardinal was unable to pass last year’s team which finished the season with 15 victories.

USC: The Trojans stayed in the game by going 27 of 36 from the free-throw line, while Stanford went 8 of 14. … It is the third time in the last 18 seasons, the Trojans have earned 15 victories in their first 18 games, also doing it in 2017 and 2016.

UP NEXT

Stanford plays at Cal on Jan. 26.

USC plays at Oregon on Thursday.

___

For more AP college basketball coverage: https://apnews.com/Collegebasketball and http://twitter.com/AP_Top25