TUCSON, Ariz. (AP) — Stanford is the only Pac-12 school that hasn't beaten Arizona in coach Sean Miller's eight seasons in Tucson.

The Cardinal sure came close on Wednesday night.

Allonzo Trier scored 22 points and made 12 of 12 from the free-throw line, helping the No. 9 Arizona escape with a 74-67 victory.

Trier got his biggest offensive output since he returned to the team six games ago. This was his first start of the season.

"I'm just pretty much getting going," Trier said. "I'm doing my best. Each game though is just more experience for me and allows me to get more comfortable with my teammates out there."

Lauri Markkanen emerged from a three-game shooting slump to make a 3-pointer that gave the Wildcats the lead for good, 70-67, with 1:40 to go.

Trier added two free throws with 23.7 seconds to go.

Arizona (22-3, 11-1 Pac-12) led most of the game but never by more than 12 points.

Reid Travis led Stanford (12-12, 4-8) with 26 points.

"We showed ourselves that we can play against anyone in the country if we're playing hard," he said, "so although the loss hurt, it is definitely something that's going to fuel us going into the next couple of games."

Arizona beat the Cardinal by 39 at Stanford on Jan. 1, but Stanford was coming off a big win over Utah.

"I think our guys expected to win," Cardinal coach Jerod Haase said. "We put ourselves in position, and all we talked about all night was trying to get ourselves in position in the last four or five minutes. I think our guys made a lot of plays, but at the end of the day we couldn't seal it."

Rawle Alkins added 12 points and Chance Comanche had 11 for the Wildcats, who won the game at the free-throw line, going 25 for 29 to Stanford's 9 for 12. The Wildcats made their last 19 free throws.

Marcus Allen scored 15 points and Dorian Pickens had 12 for Stanford, which lost to Arizona for the 15th straight time.

Arizona looked to have a hangover from its 85-58 loss at Oregon last Saturday, a blowout defeat that snapped the Wildcats' 15-game winning streak.

Miller was in a cranky mood afterward, mainly because of poor defense and rebounding.

"When you let teams get 17 second-chance points, it really puts a lot of pressure on your ability to win," Miller said. "The other thing is we have a number of players that can't guard their man."

Stanford never led after the game's first eight minutes but stayed close with the inside domination of Travis. The Cardinal tied it twice late, the last time at 67-67 on Allen's layup with 1:56 to go.

After Allen started the second half with two free throws to cut the Arizona lead to 35-34, the Wildcats scored the next eight — a 3-pointer and driving layup by Alkins, followed by Kadeem Allen's 3 — to put Arizona ahead 43-34.

Simmons' free throw with 11:22 to play gave the Wildcats their biggest lead at 50-38. But Arizona went 7:32 without a field goal before Dusan Ristic's rebound basket put Arizona up 61-57 with 5:18 left. Comanche's two free throws padded the lead to 63-57 with 4:51 to go.

Stanford caught up with an 8-2 spurt, tying it at 65 when Pickens made a 3-pointer with 2:23 to play. Trier's two free throws made it 67-65 before Allen got free inside after an offensive rebound and scored to tie it for the final time.

POOR MARKKMANSHIP

Markkanen's big 3 was his second field goal in nine tries. He was 2 for 7 on 3-pointers.

Overall in his last three games, Markkanen is 4 for 20 from the field, 3 for 13 on 3s.

Miller said he thought Markkanen's confidence was shaken and the big field goal at the end should help restore that. He was more concerned that the 7-foot freshman had just three rebounds.

BIG PICTURE

Stanford is obviously improving and will be no pushover down the stretch. Arizona stayed atop the Pac-12 standings but the Wildcats have some work to do to fix their recent issues.

UP NEXT

Stanford: The Cardinal look to avenge a home loss to Arizona State with a rematch against the Sun Devils on Saturday night in Tempe.

Arizona: The Wildcats go for a Bay Area sweep when they host California on Saturday night.

___

More AP college basketball: www.collegebasketball.ap.org and https://twitter.com/AP_Top25 .