Updated

Nick Johnson kept Arizona's perfect season going for another game, hitting a go-ahead 3-pointer with 51 seconds left and a pair of free throws with 5.8 seconds to go as the top-ranked Wildcats survived for a 60-57 victory over Stanford on Wednesday night for their school-record 21st straight win.

After Johnson hit a jumper in the middle of the key with 2:36 remaining to make it 55-53, Dwight Powell answered on a baseline drive with 1:21 to go before Johnson delivered once more.

Johnson finished with 16 points, five rebounds and four assists and T.J. McConnell added 11 points, eight rebounds and four assists for Arizona (21-0, 8-0 Pac-12), off to the program's best start in conference play in more than a decade.

Arizona is one of three unbeaten teams left in Division I basketball, joining No. 2 Syracuse, which also won Wednesday night. Fourth-ranked Wichita State hasn't lost either.

Powell and Josh Huestis each scored 13 points for Stanford (13-7, 4-4), which outshot Arizona 38 percent to 36 percent.

Johnson missed a free throw with 28 seconds left and Stanford called timeout. Huestis missed a 3 from the left wing and Aaron Gordon secured the rebound, but he also missed a free throw giving the Cardinal one final shot.

Chasson Randle missed a long 3 just before the final buzzer for Stanford, which went cold down the stretch and were held scoreless for nearly nine minutes.

After a 3-pointer by Huestis with 10:03 reamining, Stanford didn't score again until Powell's layin at 1:21 — and Powell missed a pair of free throws at 4:36 that would have put his team ahead.

Arizona, ranked No. 1 for a school-record eighth consecutive week, overcame a slow start on the way to an eighth straight win against Stanford.

The Cardinal beat two top-25 teams already with victories at then-No. 10 Connecticut and at then-No. 17 Oregon earlier this month.

But not this time given their struggles in the waning moments at Maples Pavilion, which hosted a No. 1 men's team for the first time since losing 72-69 to Arizona on March 1, 2003.

Arizona missed two shots — both by Johnson — from close range in the opening minute and began the game 1 for 9 against a smothering Stanford man-to-man defense that made it tough for the Wildcats to get good looks. Stanford also took a quick 7-3 rebounding advantage.

In a sloppy start, Arizona was whistled for a pair of offensive fouls, Aaron Gordon air-balled a 3-point try, while Rondae Hollis-Jefferson missed a pair of free throws at the 14:11 mark.

The Wildcats had a large contingent of fans in the crowd cheering "U of A! U of A!"

McConnell's jumper at 10:58 gave Arizona its first lead of the opening half. Gordon, from nearby San Jose, scored his first points midway through the half and Arizona missed four of its initial five 3-point attempts.

Brown beat the halftime buzzer with a basket to put Stanford ahead 31-30 at the break. Arizona had trailed at halftime several times already this season only to produce a big second half.

The Wildcats shot 8 for 22 and made only 12 of 21 free throws in a first half featuring eight lead changes.

Stanford's last home win against a No. 1 team came against Arizona, 82-74, on Feb. 4, 1988.