With 12:05 to go, No. 21 New Mexico was leading No. 10 San Diego State by 16 points and appeared to have all but claimed another Mountain West Conference championship.
Big men Cameron Bairstow and Alex Kirk were dominating inside. The Lobos were on a 15-0 run.
And then San Diego State coach Steve Fisher agreed with assistant Justin Hutson and switched to a 1-3-1 zone defense. The game turned just like that, with SDSU going on a 19-1 run that carried it to a 51-48 win.
Now it's the Aztecs who will hang a banner in Viejas Arena and get the No. 1 seed in the conference tournament in Las Vegas.
"They did a good job with it," Bairstow said of the Aztecs' zone. "They're long and athletic. I think it surprised a lot of guys. We weren't able to settle down. When things went south, I don't think we did a very good job of staying positive and keeping composed."
Xavier Thames scored 23 points for SDSU (27-3, 16-2). Josh Davis, SDSU's other senior, had nine rebounds and six points, including some big plays during a 19-1 run that pulled the Aztecs back into the game.
Thames and Matt Shrigley each made two free throws in the final 9 seconds for SDSU.
The fans rushed the court and black and red confetti fell from the ceiling at Viejas Arena, where the Aztecs were 15-1 this season. Their only home loss was to Arizona on Nov. 14.
Bairstow scored 20 points and keyed two big runs for New Mexico (24-6, 15-3).
But it wasn't enough.
"They changed the tempo on us and did some things with the zone and we struggled with it," New Mexico coach Craig Neal said. "I thought we'd be able to handle it and we didn't do a very good job of that. We had a 16-point lead and everything was going good, then we stopped getting stops defensively and got them going in transition.
"They had 22 points off turnovers and I told our guys that if we could stay under 12, we could win. They turned us over 16 times. It's a tough learning experience for our guys."
With SDSU leading 47-45, New Mexico's Kendall Williams, last season's Mountain West player of the year, missed a 3-point shot with 9 seconds left.
Thames rebounded and was fouled by Kirk, making both for a four-point lead. Thames had a steal and Shrigley was fouled by Cullen Neal, making both for a 51-45 lead. Williams made a 3-pointer with 1 second left.
New Mexico led 41-25 after Kirk made a turnaround jumper with 12:05 left, capping a 15-0 run in which he and Bairstow did most of the scoring.
But the Aztecs came racing back with an airtight defense and big scoring plays by Thames, Davis, Shrigley and Dwayne Polee.
SDSU scored nine straight points, starting with an inside shot by Davis, to pull to 41-34 before Bairstow made the second of two free throws.
The Aztecs scored the next 10 points to take a 44-42 lead. Polee had two steals and Davis one. Davis had a slam dunk, Shrigley a layup — he missed the free throw that would have made it a three-point play — Polee a layup, Thames a layup and Polee another layup.
New Mexico made its first field goal in more than seven minutes when Deshawn Delaney made a 3-pointer for a 45-44 lead.
Thames hit a jumper to give SDSU a 46-45 lead. Kirk missed two free throws with 59.1 seconds left and Davis rebounded the second miss. JJ O'Brien made the first of two free throws to give SDSU a two-point lead.
Bairstow had scored 26 points in a 14-point New Mexico win against the Aztecs in Albuquerque two weeks earlier.
The Lobos ended the first half on a 15-2 run to take a 26-20 lead. Bairstow had seven points in the run, including a long jumper at the buzzer, and fed Kirk for easy shots on consecutive possessions.
Bairstow had 13 points in the first half and Kirk nine. The only other Lobos to score in the first half were Williams and Neal with two points apiece.
Earlier, the Lobos went 8½ minutes in between field goals as SDSU went on 12-0 run fueled in part by Josh Davis' rebounding. Davis had a coast-to-coast layup while Winston Shepard had a three-point play and a twisting jumper to give SDSU a 16-9 lead. New Mexico finally scored when Neal made a layup.