Ivan Rabb made the big plays when Cal needed them most, helping the Golden Bears knock off No. 25 USC 74-73 in a Pac-12 Conference thriller Sunday night at the Galen Center in Los Angeles.

Cal tied the game on a 3-pointer by Charlie Moore and took a 72-71 lead on a 3-pointer by Jabari Bird with 2:16 remaining. Jordan McLaughlin made a driving layup to put USC up with 17 seconds left, but Rabb sank two free throws with five seconds to play to give Cal the lead and then blocked McLaughlin's layup attempt as time expired.

Rabb posted 17 points and eight rebounds for Cal (11-5, 2-2 Pac-12). Moore scored 16 points for the Bears, and Bird and Don Coleman added 12 points apiece.

Chimezie Metu and McLaughlin scored 20 points apiece for USC (15-2, 2-2). De'Anthony Melton contributed 13 points and eight rebounds.

Cal coach Cuonzo Martin summed up his team's strategy on its final possessions.

"Go to Ivan ... he made the play," Martin said.

USC coach Andy Enfield suggested the officials could have whistled Rabb for a foul when he blocked McLaughlin's shot at the buzzer.

"The last play, there was a lot of contact at the rim," Enfield said. "You can't ask for more. Jordan could've easily scored or gone to the foul line, but he didn't."

McLaughlin said he thought he had enough space to get to the basket before Rabb came over to make the block.

"I came out of the timeout with a full head of steam," McLaughlin said. "I tried to get a layup and hoped to get a basket or a foul. I saw a wide-open lane. They closed it at the end."

The teams exchanged leads numerous times throughout the first half. Cal went up 13-8 on a layup by Coleman and led 18-12 following a jumper by Grant Mullins midway through the opening period. The Golden Bears took a 23-16 lead on a 3-pointer by Mullins, but the Trojans battled back.

USC got within one on a jumper by Metu and took a 26-25 lead on two free throws by Melton. Cal reclaimed the lead on a three-point play by Coleman late in the half. The game was tied 36-36 at the break after McLaughlin made a 3-pointer with four seconds remaining.

The Bears went ahead 40-36 on a dunk by Kingsley Okoroh early in the second period. They stretched the lead to six on a 3-pointer by Bird and went up 51-43 on a three-point play by Rabb, but the Trojans stormed back with a 10-0 run to take a 53-51 lead on a 3-pointer by Shaqquan Aaron.

The teams traded baskets over the final 12 minutes until Rabb denied McLaughlin in the waning seconds.

Cal shot 47.5 percent from the field, made 9 of 23 from 3-point range and amassed a 35-28 rebounding advantage.

USC shot 50.9 percent and made 7 of 12 from beyond the arc, but the Trojans were an abysmal 10 of 21 at the free-throw line.

"It was just one of those nights at the line," McLaughlin said. "That's basically where we lost the game."

Martin didn't seem surprised with his team's first victory over a ranked team since last February.

"This is a team that is supposed to be a good team," he said.

NOTES: USC went into the game as one of only nine Division I teams in the country with one loss or none. ... USC failed in its bid to improve to 3-1 in conference play for just the second time in the past 10 seasons. ... Cal faced a ranked opponent for the fourth time in five games. ... With three blocked shots Sunday, junior C Kingsley Okoroh became the seventh player in Cal history to block at least 100 career shots.