PASADENA, Calif. (AP) — When Anthony Barr roared through the line and hit Matt Barkley squarely in the No. 7 on his back, the roar rising out of the Rose Bowl was loud enough for a whole city to hear.

After so many years in Southern California’s shadow, U.C.L.A. is on top of Los Angeles and their division, thanks to a first-year head coach and a freshman quarterback who do not seem to realize that they have done something unusual.

Brett Hundley passed for 234 yards and a touchdown and rushed for two more scores, and No. 17 U.C.L.A. beat No. 21 U.S.C., 38-28, on Saturday to clinch the Pacific-12 South title and emphatically snap a five-game losing streak in their crosstown showdown.

Eric Kendricks blocked a punt and made a fourth-quarter interception for the Bruins (9-2, 6-2 Pac-12), who overcame intermittent second-half rain and U.S.C.’s star-studded lineup with a steady effort.

“When the season started, obviously nobody thought we were going to do what we’re doing now,” said Hundley, who completed 22 of 30 passes and did not throw an interception. “But we all knew deep down inside that we could do it, that we had the talent. We can do everything we set our mind to, as long as we work hard.”

A year after U.S.C. obliterated the Bruins, 50-0, in a game that led to a coaching change in Westwood, U.C.L.A. punctuated its one-year revitalization under Coach Jim Mora with its first win over the Trojans (7-4, 5-4) since 2006 — and just its second in 14 years. The Bruins celebrated in the corner of the Rose Bowl and again with an impromptu dance-off in the locker room, even while Mora reminded them they still have three games to play.

“It’s a great moment, and I’m excited,” said Mora, the winningest first-year coach in U.C.L.A.’s history. “I can’t wait to hug my mom, shake my dad’s hand and kiss my kids. I don’t want to minimize it at all.”

Johnathan Franklin rushed for 171 yards and 2 touchdowns for U.C.L.A., including a 29-yard scoring run with 4 minutes 2 seconds left, after U.S.C. had trimmed its deficit to 3 points.

Shaquelle Evans had eight catches for 114 yards for U.C.L.A., which clinched a spot in the Pac-12 title game in two weeks with its fifth consecutive win. The Bruins also played in that game last year, but only by default: they finished two games behind U.S.C., which was barred from the postseason.

Everything has changed in Los Angeles this season: U.C.L.A. entered its showdown against U.S.C. with a higher ranking and more victories for the first time in a decade, and the Bruins proved that was not a fluke.

“It’s a great night, but we’ve got so many things we still want to do,” Franklin said. “We’re going to enjoy it, but we were confident coming into this game.”

Barkley passed for 301 yards and 3 touchdowns, but he also threw two interceptions in the Trojans’ third loss in four games. U.S.C. was ranked the No. 1 team before the season, but it will return to the postseason in a lower-tier bowl after next week’s regular-season finale, against Notre Dame.

“You wouldn’t think we would lose this game with a senior quarterback versus a freshman,” U.S.C. Coach Lane Kiffin said. “We’re extremely disappointed with this season. We’re too talented to have that many losses.”

Hundley led U.C.L.A. with the same preternatural calm he has shown all year, but Barkley threw an interception on the game’s first play and rarely looked comfortable. Barkley was hammered on a blindside sack by Barr with 2:21 to play, spending a long moment on the Rose Bowl turf before walking off gingerly and watching U.S.C.’s final drive from the sideline.

Nelson Agholor and Randall Telfer caught touchdown passes for the Trojans, and Curtis McNeal rushed for 158 yards. Marqise Lee had nine catches for 158 yards, and Robert Woods had five catches for 68 yards.

“U.C.L.A. did a great job, but we’re very disappointed,” Lee said, adding: “Other people, they’ll be sad. But to me, we came out against a great team and had too many turnovers.”

A version of this article appears in print on November 18, 2012, on page SP8 of the New York edition with the headline: U.C.L.A. Clinches Division By Ending Skid vs. Trojans. Order Reprints|Today's Paper|Subscribe