TUCSON, Ariz. (AP) -- Deandre Ayton overpowered Alabama's big men all night, something he's done consistently during his freshman year. Allonzo Trier turned it on in the second half, playing with a rare efficiency.
When Arizona's top two players are at their best, the Wildcats are mighty tough to stop.
Ayton had 29 points and 18 rebounds, Trier scored 20 of his 25 points in the second half and Arizona outlasted Alabama 88-82 Saturday night.
''If I can throw it into Deandre, ain't nobody going to leave me, so he has all the room to work,'' Trier said. ''One person between him and the basket, he's going to score all day.''
Arizona's first real home test and the fans were ready, making McKale Center louder than it's been all season.
The Wildcats (7-3) responded with their second quality win of the week, backing up a victory over No. 7 Texas A&M with a strong all-around performance to win their 45th straight nonconference home game.
Alabama (7-3) matched Arizona nearly shot for shot in one of college basketball's toughest road environments, pulling within 84-80 on Riley Norris' 3-pointer with 38 seconds left.
The Crimson Tide could not get any closer as Trier, who took just six shots, hit three free throws in the final 34 seconds to seal it for Arizona.
Arizona had 43-30 rebounding advantage and shot 52 percent.
Collin Sexton scored 21 of his 30 points in the second half, and Donta Hall had 15 points and 12 rebounds for Alabama.
''During the SEC, we're going to have to go Kentucky, Missouri and places like that with ... the same type of crowds,'' Sexton said. ''We were in their place and said, 'Let's win.'''
Arizona's defense was a sore spot to start the season, leading to three straight losses in the Bahamas that dropped the Wildcats out of the AP Top 25 from No. 2 - a first since Louisville in 1986.
Even when the Wildcats rolled over Long Beach State, coach Sean Miller lamented their defensive effort in a 25-minute postgame rant.
Arizona shored up its defense on Tuesday, when it grinded out a 67-64 victory over No. 7 Texas A&M in Phoenix.
The Wildcats were good defensively in stretches, had Miller turning dark shades of red at other times.
''Certainly, there's room for improvement,'' he said.
For their first big home test, the Wildcats got back sophomore guard Rawle Alkins, a tough, emotional player who Miller hoped would give them a lift.
Arizona had a spark before Alkins even entered the game, efficiently working its offense during a 10-0 run that put the Wildcats up 24-13. The Crimson Tide fought back behind their defense, using a 13-2 run to tie it at 26-all.
Alabama had no one who could stop Ayton in the first half - 15 points and nine rebounds - but Sexton banked in a 3-pointer at the buzzer to put the Tide up 40-38.
The Crimson Tide went on a quick run to start the second half, but Arizona rallied and the teams traded athletic plays, neither to gain much separation.
Alabama closed in around Ayton to limit his shots, but Trier got free multiple times to keep the Wildcats around the lead.
Sexton was Alabama's go-to player, confidently stroking in long 3-pointers and driving to the basket.
Alabama came up short, but handling a hostile environment at McKale Center and keeping it close against a good team should only help the Crimson Tide later in the season.
Arizona could find itself back in the AP Top 25 next week after two quality wins.
Scoring 25 points on six shots is not easy to do, but Trier managed it by making 3 of his 5 shots from the 3-point arc and 14 of 16 from the free-throw line.
Alabama had been one of the nation's worst free-throw shooting teams, entering Saturday's game shooting 63 percent. The Crimson Tide found their stroke at McKale Center, hitting 24 of 28, including 15 of 16 by Sexton.
''Coach always said, 'They're going to fall,''' Sexton said. ''He told us to continue to work. If we keep working, they're going to start falling.''
Arizona, which shoots 76 percent on the season, went 22 for 35.
Alabama hosts Mercer on Dec. 19.
Arizona plays at New Mexico next Saturday.