STANFORD, Calif. -- Stanford stormed ahead with 11 straight points midway through the second half, and No. 14 Arizona powered right back with 11 of their own, a run capped by Allonzo Trier's tying 3-pointer.
So with the Cardinal leading by one in the final minute, it wasn't too hard to believe the Wildcats would rally again.
Rawle Alkins made a go-ahead layup with 38 seconds remaining, and Arizona earned a 73-71 comeback win Saturday at Stanford for their 16th straight victory against the Cardinal.
Trier, who led the Wildcats (16-4, 6-1 Pac-12) with 21 points, added three free throws in the final 18 seconds. Dusan Ristic added 18 points and nine rebounds, and Alkins scored 13 points for Arizona. Deandre Ayton had nine points and blocked six shots before fouling out in the closing seconds.
"I give our guys credit, they dug deep. It didn't look good at that moment, but our effort continued to be very good or maybe increase," Arizona coach Sean Miller said of Stanford's 11-point run, during which he picked up a technical foul after Deandre Ayton was called for his fourth foul. "Winning on the road is hard."
Reid Travis had 20 points and 10 rebounds for Stanford (11-9, 5-2), which beat No. 16 Arizona State three days earlier and was on a five-game winning streak.
"You saw some great spurts tonight, but giving up that 11-point lead is obviously tough," Travis said. "There's a lot of learning to do."
Stanford, which trailed by 12 points in the first half, capped its 11-point spurt midway through the second half on a 3-pointer by Dorian Pickens with 9:29 remaining. But 3-pointers by Dylan Smith, Alkins and Trier propelled the Wildcats' 11-point run to tie it with 6:20 left.
Neither team led by more than four points the rest of the way. After Trier hit one of two foul shots with 4.2 seconds left, Pickens missed a running 3-pointer for Stanford at the buzzer.
Arizona's 16 straight wins against Stanford mark the longest streak by either school in the series that dates to 1937. The Wildcats also had won 15 consecutive games against the Cardinal from 1989 to 1995. Miller, in his ninth year as Arizona coach, is now 15-0 against Stanford.
Alkins had 13 points, seven rebounds and five assists in 34 minutes for Arizona after being held out of Wednesday's victory at California because of soreness in his right foot, which was surgically repaired in the offseason and caused him to miss the first nine games this season.
Stanford starting point guard Daejon Davis, who had 13 points while playing all 40 minutes of the win against Arizona State, had two points in the first half against Arizona before rolling his ankle late in the period. He did not return.
Arizona: The Wildcats have won 13 of 14, but this one was closer than the 12 other victories -- which had come by an average margin of 11 points.
Stanford: The Cardinal's five-game winning streak was their longest in conference play in a decade.
Arizona: The Wildcats return home, where they have not lost in 10 games this season, to face Colorado on Thursday.
Stanford: The Cardinal start their annual two-game trip to Los Angeles on Wednesday at Southern California. Stanford is 2-5 away from home this season, including 0-4 at neutral sites.
More AP college basketball: https://collegebasketball.ap.org and https://twitter.com/AP-Top25
Williams ties single game record with 15 3s, drops 49 points
Robert Morris' Josh Williams hits 15 3-pointers to tie the D-I record, as he finishes with 49 points in the victory.
High-scoring No. 3 Gonzaga hosts Texas A&M
While both Gonzaga and Texas A&M have dealt with early-season injuries, the Bulldogs haven't missed a beat.
James with 23 points leads Wyoming over Grambling 86-78
Justin James scored 23 points and grabbed seven rebounds and Wyoming edged Grambling 86-78 on Wednesday night.