LAS VEGAS (AP) — Colorado had trouble holding onto the ball, didn't shoot particularly well and let a double-digit lead slip to three in the final minute.
The Buffaloes found a way to overcome it all and are headed into the Pac-12 Tournament quarterfinals.
McKinley Wright IV scored 18 points and Colorado overcame a season-high 23 turnovers to hold off California 56-51 on Wednesday in the opening round.
"Well, that was the epitome of winning ugly. Probably an understatement," Colorado coach Tad Boyle said. "But I these guys in the locker room, our program is built on defense and rebounding for a reason. It's for days like this, games like this, when the offense is not functioning the way we want it to function, that we find a way to win a game by guarding, by rebounding."
The fifth-seeded Buffaloes (20-11) gave up 17 points from their turnovers, but made up for it shutting down the Bears defensively and outrebounding them 40-19.
Colorado used an eight-point burst midway through the second half to go up 10 and held off a late Cal charge to remain undefeated (8-0) in Pac-12 Tournament first-round games
The Buffaloes move on to face No. 4 seed Oregon State in Thursday's quarterfinals.
"I think we were rushing a lot of things tonight," Wright said. "We were anxious to go out and play the first round of the tournament and to make 23 turnovers was too much. We're happy to get out with a win. We'll be better tomorrow."
The 12th-seeded Bears (8-23) shot nearly 50 percent while winning their final three regular-season games, but reverted to their shooting struggles in the Pac-12 Tournament.
Cal trimmed a 10-point lead to three in the final minute and had a shot to tie after a 3-pointer by Wright was waved off upon review. Matt Bradley got a decent look at a 3-pointer, but his shot hit the front rim and Colorado's Tyler Bey hit two free throws with 2.4 second left to seal it.
Bradley had 17 points to lead the Bears, who shot 34 percent.
"I felt like in the first half we were a little stagnant offensively," Cal coach Wyking Jones said. "We had a couple of scoring droughts, but defensively I thought we did a really good job. I was definitely happy with my team's effort today."
Cal lost its first 15 Pac-12 games before stunning eventual champion Washington on Feb. 28. The Bears followed with wins over Washington State and rival Stanford to close out the regular season and head into the conference tournament on a mini roll.
The Buffaloes landed in Las Vegas on a bit of roll as well, winning eight of their final 10 games to just miss an opening-round bye as a top-four seed.
Colorado won the lone regular-season meeting 68-59 after blowing an 18-point lead.
The rematch was a defensive battle early, with neither team able to get into much of a rhythm.
The Buffaloes triggered a 13-2 run with their defense, going up 23-14 after a pair of steals and break-away dunks by Daylen Kountz. Cal went more than five minutes without scoring during Colorado's run.
"Our defense is a lot better when we score," Jones said. "And we just have more energy, we're able to set our defense after we score. I just felt like the drought affected us, even though we still held them to a decent percentage."
Colorado took control with a quick 8-0 spurt to go up 10, but went more than three minutes without scoring as Cal cut the lead to 50-47.
The Bears were able to keep Colorado within reach, but couldn't come up with the big plays when they needed them.
Colorado played just well enough to win, but will need to clean up the turnovers if it's going to advance again in the tournament.
Cal's late-season offense resurgence ended in Las Vegas and so did its disappointing season.
Colorado faces Oregon State in the Pac-12 quarterfinals.
Cal's season is over.
More AP college basketball coverage: https://apnews.com/Collegebasketball and https://twitter.com/AP_Top25