USC's Jio Fontan made two free throws with seven seconds left to put the Trojans up two. The Cardinal's Chasson Randle missed the game-tying jumper with three seconds left and Dwight Powell missed the put back to give the Trojans a win in their Pac-12 opener.
The Trojans went on an 18-9 run to tie it up at 51 with 10:56 remaining in the second half. Fontan finished with 15 points off the bench as Eric Wise added 14 points to help lead four Trojans in double-figures.
The Cardinal put four in double-figures led by Andy Brown's 17 points. Aaron Bright (12 points, five assists), Dwight Powell (11 points) and Josh Huestis' double-double (10 points, 12 rebounds). But they weren't enough to prevent the Cardinal from being upset.
Stanford fell to 9-5 while the Trojans are 6-8.