Spencer Jones scored 26 points, James Keefe had 16 and 10 boards, and No. 9 Stanford somehow, someway pulled out an epic comeback win over No. 8 Arizona State Wednesday in the opening round of the 2022 Pac-12 Tournament.

The Cardinal trailed for more than 37 minutes in the game. For a moment late, Stanford looked dead in the water. And for long stretches, it seemed like Arizona State would shoot itself to the win.

The conference tournament record for made triples in a game was set in a Stanford-Arizona State contest—the Cardinal hit 15 3-pointers back in an overtime game in 2013—and it was matched on Wednesday in the first game of the 2022 conference tournament. This time, though, it was Arizona State getting a little payback. The Sun Devils drilled their 15th 3 of the game—on their 28th attempt of the game—with 4:04 to play. Jones had just hit one of his own at the other end to bring the Cardinal within nine points, the closest it had been in over 10 minutes.

It was ASU’s Jay Heath tying the record, but it was Arizona State’s mercurial guard trio of DJ Horne, Marreon Jackson, and Heath who got the Sun Devils there.

Horne scored 21 points on 5-of-12 shooting from 3. Jackson had 14 points with three made 3s. Heath got all 12 of his points from beyond the 3-point line, shooting 4-of-6 from deep. As a team, the Sun Devils shot 54% on triples and made eight more than Stanford.

And—incredibly—it didn’t matter.

In the first half, ASU was red-hot, but it never quite separated from the Cardinal. Credit Stanford for just finding ways to hang around and keep things close. It was a four-point game at the break.

ASU got up by as many as 17 with 13:35 to play in the second half, but then the shooting plateaued. Sometimes for a team that plays fast, to get up so big with so much time left, you get yourself stuck between a rock and a hard place. Do you throttle back to chew clock, but risk pulling yourself out of the offensive groove you were in? Or do you keep the pedal down, running the risk that if your shots stop falling you leave your defense in compromised positions?

The Sun Devils looked like they were trying to live in both worlds and it cost them. After going up 17, ASU missed 12 of its next 13 shots.

At the other end, Stanford used Keefe as the screener to slip and dive to the hoop and just started chipping away at the lead. Keefe got 10 of his 16 in the second half. A 13-3 run from the Cardinal brought the score right back.

A monster slam from ASU’s Kimani Lawrence on the fastbreak with 3:01 to play looked like it would break Stanford’s back. Instead, Lawrence missed the and-one free throw after a timeout and Stanford punched right back. Keefe got a jumper in the lane to fall, then Brandon Angel (15 points) got to the rim, then Keefe got to the rim, then Harrison Ingram and Jones each got to the foul line, Angel got back to the bucket, and in less than two minutes’ time, Stanford had trimmed a 14-point lead down to three.

Jackson split a pair of foul shots and then Jones came down and buried his sixth triple.

Stanford would get the last shot of the game, down one point, and it was Keefe who delivered.

Arizona State will look back with some frustration over the way it closed the game. Poor clock management, poor shot selection, giving up the lane too often on defense. But credit the Cardinal. Stanford just kept fighting.

“Our guys believed,” said an emotional Stanford head coach Jerod Haase after the game. “It wasn’t pretty, but we don’t want to be pretty.”

The win snapped a five-game losing streak for Stanford (16-15), who will now face top-seeded Arizona on Thursday at noon PT. Arizona State (14-17) had won four straight and seven of its last eight, but the loss means its season will now come to an end.