Kevin Pangos' layup with 2.2 seconds to play gave the 10th-ranked Gonzaga Bulldogs a 71-69 win over the Washington State Cougars.
"My thought process was to just get to the rim," Pangos said of the layup.
Elias Harris posted 23 points and six boards while Kelly Olynyk scored all 22 of his points in the second half for the Bulldogs (9-0), who are off to their best start in school history.
Brock Motum gave 23 points while DaVonte Lacy added 22 points for the Cougars (5-4), who had a three-game winning streak stopped.
"Gonzaga is very good," Cougars head coach Ken Bone said. "There is a reason they are the No. 10 team in the country."
The Cougars had trailed by 11 in the second half, but kept it from getting out of hand.
With Gonzaga holding a nine-point lead, Motum hit consecutive 3-pointers then Lacy buried a 3-ball with 2:57 to play to tie the game.
Olynyk followed with a 3-point play on a layup and free throw, but Motum and Lacy countered on a pair of free throws as Lacy's two gave the team a 64-63 lead with 1:29 left.
Olynyk countered with a layup and Washington State's Junior Longrus was called for an offensive foul, which led to an Olynyk 3-pointer with 35.4 seconds to play.
A turnover from the Cougars saw Pangos go to the line, but he missed his shot. Lacy missed a 3-point shot, but Longrus grabbed the offensive board and got it to Motum, who drained a 3-pointer with 14 ticks left on the clock.
Gary Bell hit one-of-two from the line and the Cougars had no timeouts, but Lacy drove for a layup with 7.8 showing on the game clock.
Pangos, though, drove the length of the court and got his shot in with 2.2 to play and a desperation heave from before midcourt never had a chance.
The game stayed close early until a 12-0 run from Washington State capped on a Lacy 3-pointer gave the team a 19-11 lead with 10 1/2 minutes to play in the first half.
Gonzaga kept it close and took a 27-25 lead with a 6-0 run, but the Cougars closed the half with the final six points to take a 31-27 advantage into the locker room.
It stayed tight for the first four minutes of the second half, but a Olynyk layup gave the Bulldogs the lead.
Olynyk scored six straight points during the 9-0 run that saw a 3-pointer from Bell give the team a 44-36 lead with 13 minutes to play in the game.
Gonzaga hosts Illinois on Saturday ... Washington State leads the series, 98-49, but the Bulldogs are 8-2 against the Cougars when they are ranked ... Gonzaga made 50.9 percent of its shots while Washington State connected on 45.3 percent ... Pangos finished the game with eight points while Bell had 14.