Jesse Perry added 11 points and Nick Johnson and Solomon Hill had 10 each for the Wildcats (16-8, 7-4 Pac-12), who have won two in a row for the first time since a three-game winning streak at the end of December.
Stanford struggled with its worst field-goal percentage of the season, 25.4 percent. Arizona wasn't much better, but the Wildcats made six of their final eight shots to pull away.
The Wildcats led by eight with 5:35 remaining in the first half. Stanford tied the game at 23 before a free throw gave Arizona a 24-23 edge at the intermission.