Nunes' key TD strike came early in the fourth quarter and capped a performance in which he connected on 15-of-32 throws for 215 yards and was intercepted two times.
Stanford's defense also rose to the occasion late in the contest, sacking USC's Matt Barkley twice in the final minute.
Stepfan Taylor scored twice, compiling 153 yards on 27 carries for the Cardinal (3-0, 1-0 Pac-12), who have beaten the Trojans four straight times.
USC (2-1, 0-1) couldn't score in the second half.
Barkley was held to 254 yards on 20-of-41 passes with two interceptions.