LOS ANGELES -- Deep into the fourth quarter, Southern California and Texas played a defense-dominated, turnover-plagued game that had none of the poetry or flair of these powerhouse programs' last meeting in the 2006 Rose Bowl.
Then the offenses finally found their stride. Texas' freshman quarterback led a gutsy 91-yard touchdown march in the final minutes of regulation. USC answered with a desperate drive to force overtime.
By the time walk-on Chase McGrath hit a walk-off field goal, this famed matchup definitely had its mojo back.
Sam Darnold passed for 397 yards and three touchdowns, and USC's freshman kicker hit a 43-yard field goal to end the No. 4 Trojans' thrilling 27-24 victory over the Longhorns on Saturday night.
Vince Young and Matt Leinart were the quarterbacks for Texas' 41-38 victory in that famous Rose Bowl matchup 12 seasons ago, and they watched every twist in this sequel from the Coliseum stands.
Darnold and his Trojans (3-0) earned their own memorable win by outlasting a Texas offense led by Sam Ehlinger, the freshman from Austin who nearly engineered a huge win early in coach Tom Herman's debut season with Texas (1-2).
"It's good to get a great win against such a great Texas team," Darnold said. "We gave it all we had. They gave it all they had. It was just a great win for our guys. We learned a lot of things about our offense. Good things, and things we've got to figure out."
Christian Rector made the biggest defensive play in a game full of them, forcing a goal-line fumble by stripping the ball from Ehlinger in the second OT. McGrath then coolly ended it with the second field goal of his college career.
USC has won 12 consecutive games and 12 straight at home.
"We had to finish strong, and that's what we did," said USC receiver Deontay Burnett, who caught eight passes for 123 yards and two touchdowns.
Ehlinger passed for 298 yards for the Longhorns, who fell agonizingly short in a sold-out Coliseum.
"It's amazing how many mistakes you can overcome with attitude and effort, and we made our fair share of them," Herman said. "Turned the ball over four times, had issues with the snap, a couple of costly calls that didn't go our way, but our guys kept fighting."
The Longhorns seemed headed to the upset when Ehlinger hit Armanti Foreman with a 17-yard touchdown pass with 45 seconds left. But after Darnold drove the Trojans 52 yards in about 30 seconds, McGrath tied it with his first career field goal.
"The plays down the stretch by Sam and Deontay, I don't know if I'll ever forget in my life," USC coach Clay Helton said. "You hope for perfect execution, and that's what we got."
Burnett caught a 25-yard touchdown pass from Darnold on the first snap of overtime, shaking Leinart's hand in the back of the end zone to celebrate. Cade Brewer then caught a 3-yard TD pass to cap Texas' first OT possession.
Texas reached the goal line in the second OT before Rector ripped the ball out of Ehlinger's arm. Ajene Harris recovered, but the Trojans' offense stalled before McGrath came through again.
Darnold and Ehlinger embraced briefly after the game, with Darnold giving words of encouragement and slapping the freshman on the helmet.
"I believed in (Ehlinger)," Texas linebacker Malik Jefferson said. "That kid always has heart. He represented a lot tonight of what we want to be."
Texas: Once the heartache subsides, this will be an encouraging outing. The defense took remarkable strides forward after giving up 51 points to Maryland in the season opener. Sure, the offense needs much more work, but this type of defensive performance will win a bunch of games in the Big 12.
USC: The Trojans' offense racked up 91 points and ran the ball well in its first two games, but Texas largely shut it down. USC's defense deserves most of the credit for keeping them in a game that turned out to be much tougher than anybody expected.
The game was scoreless until 2:40 before halftime, when Burnett made a diving TD catch. The Longhorns tied it moments later when Darnold's perfect pass smacked off receiver Jalen Greene's hands and DeShon Elliott snatched it for a 38-yard TD interception return.
Instead of kneeling out the half, Darnold threw underneath Texas' prevent defense to Ronald Jones II, who sprinted across the field for a 56-yard TD. He got a devastating block from receiver Steven Mitchell on the way in.
Collin Johnson had seven catches for 191 yards for the Longhorns, including a 47-yard grab and a fourth-and-10 conversion on Texas' late regulation drive. USC couldn't defend the 6-foot-6 Californian consistently.
In the hyper-reactive world of September rankings, USC is likely to slide a bit in the Top 10 after struggling to hold on, even though its defense posted a near-shutout for 59 minutes.
Texas: After a bye week, Big 12 play begins with a visit to Iowa State on Thursday, Sept. 28.
USC: The Trojans' road opener is at California on Saturday.
More AP college football: www.collegefootball.ap.org and www.twitter.com/AP-Top25