The win allowed the Trojans (16-6, 7-2 Pac-12) to avenge a dramatic 77-76 loss at Stanford on Jan. 7 that featured a 55-foot, buzzer-beating 3-pointer by the Cardinal's Daejon Davis.
Davis had a chance to duplicate his magic in the rematch, but missed a potential game-tying 3-pointer with eight seconds to go.
Elijah Stewart countered with a win-clinching dunk for the Trojans with two seconds left, denying Stanford's attempt to rally from a 15-point halftime deficit.
Jonah Mathews came off the bench to score a season-high-tying 18 points for USC, whose only loss in its last eight games was the defeat at Stanford.
Reid Travis had 16 points and a team-high nine rebounds, while Michael Humphrey and Dorian Pickens added 14 points apiece in a balanced attack for the Cardinal (11-10, 5-3), who had won five in a row before falling to Arizona 73-71 in their most recent outing.
Stanford's Davis, hero of the earlier meeting, was held to six points.
USC led 16-12 with 11:30 remaining in the first half before Rakocevic got the game-breaking burst going with a jumper.
He added free throw and another jumper, Chimezie Metu contributed a dunk and Mathews capped off the run with a 3-pointer, pushing the Trojans' lead to 28-12 with 8:09 remaining in the half.
USC retained a 15-point advantage, 41-26, at halftime, then kept Stanford at arm's length for most of the second half.
But after a layup by Stewart increased the USC lead to 66-57 with 4:21 to play, the Trojans didn't score again until after the Cardinal had rallied within 66-64 on a pair of Davis free throws with 32 seconds left.
Jordan McLaughlin ended nearly a four-minute USC drought with a free throw with 27 seconds left, but made only one of two, giving Davis his shot at a tie in the final seconds.
Metu had 12 points and a game-high 10 rebounds for the Trojans, who won despite missing 15 of their 20 3-point shots.
Stewart finished with 10 points.
Oscar da Silva added 11 for the Cardinal, who were outshot 46.2 percent to 44.0 by the Trojans.
--Field Level Media
Stanford | Southern California | |
Reid Travis 16 | Scoring | Jonah Mathews 18 |
Dorian Pickens 3 | Assists | Jordan McLaughlin 9 |
Reid Travis 9 | Rebounds | Chimezie Metu 10 |
Dorian Pickens 6 | Free Throws Made | Chimezie Metu 2 |
Oscar Da Silva 2 | Steals | Jordan McLaughlin 3 |
Oscar Da Silva 1 | Blocks | Chimezie Metu 2 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Stanford | 64 | 44.0 | 6-19 | 14-19 | 11 | 32 | 2 | 4 | 16 |
Southern California | 69 | 46.2 | 5-20 | 4-8 | 20 | 29 | 5 | 9 | 7 |