MORGANTOWN, W.Va. -- Leg cramps weren't going to keep Juwan Staten from getting West Virginia to 20 wins for the first time in four seasons on Monday night.
Staten scored 20 points, including a layup with four seconds left, then draped Perry Ellis on the other end after a long pass before the Jayhawks forward missed a layup off the back of the rim at the buzzer as No. 23 West Virginia beat No. 8 Kansas 62-61.
"I might have rushed it a little bit, but I should have made it," Ellis said.
It was a resume-building victory for the Mountaineers (20-6, 8-5 Big 12), who had lost three of their previous four games and four straight against ranked opponents. They're looking for their first NCAA tournament bid in three seasons.
"This was definitely a must-win game at home," Staten said. "We had the crowd behind us and we fought to the end."
With the game on the line, coach Bob Huggins knew who he wanted to give the ball to: Staten, West Virginia's leading scorer and the Big 12 preseason player of the year.
Staten took an inbounds pass and went the length of the court, made a spin move around Frank Mason III and hit the left-handed layup over the outstretched arms of two other Kansas defenders.
It was Staten's first field goal over the final eight minutes after he had gone to the bench with cramps.
"That is exactly how we drew it up," Staten said. "When I spinned, I'd seen nothing in the lane. I laid the ball up. It was a good call by coach."
Ellis finished with 19 points, Mason had 18 and Kelly Oubre Jr. added 14 points for first-place Kansas (21-5, 10-3), whose lead was trimmed to 1.5 games over No. 14 Iowa State.
Jevon Carter, who also played through leg cramps, added 13 points for West Virginia, including back-to-back 3-pointers to put the Mountaineers ahead 60-59 with 2:31 remaining.
"I've got to give a lot of credit to my teammates for setting me up with good passes and good screens leading to open shots," Carter said. "I just dug deep, knocked them in and gave my team the momentum."
Mason made a layup with 2:13 left to give Kansas the lead, but the Jayhawks didn't score again. He missed another layup with nine seconds left and the ball went out of bounds, setting up Staten's heroics.
"He made a nice play, but we couldn't have defended it worse," said Kansas coach Bill Self.
Ellis had 15 points after halftime, capping a 10-0 run to start the second half with a 3-pointer to put Kansas ahead 40-33. But the Jayhawks later went seven minutes without a field goal.
Staten hit a layup and a jumper 50 seconds apart, and Jonathan Holton made a free throw to put West Virginia ahead 50-49 with 7:20 left.
"We had our chances but we just didn't capitalize," Self said. "The end of the game was a perfect example. Jamari makes the best pass of the year, Perry catches it right in stride, has an uncontested layup and basically he just missed the layup."
Kansas: The Big 12's top 3-point shooting team made 6 of 11. ... Wayne Selden, who averaged 16 points over his five previous games, was held to four Monday night.
West Virginia: The Mountaineers led by as many as 11 points in the first half, were ahead 33-30 at halftime and were outscored in the second half for the fifth straight game. ... Devin Williams reinjured his right hand that had been heavily taped in a loss at Iowa State on Saturday. Williams, who had 22 points and 13 rebounds a year ago in a home win over Kansas, finished with eight points and four rebounds.
Huggins admits his team doesn't shoot well consistently, which is why he stresses getting multiple chances on offensive possessions. West Virginia leads the nation with 17 offensive rebounds per game and got 22 on Monday night.
Kansas hosts TCU on Saturday.
West Virginia plays at No. 22 Oklahoma State on Saturday.
Martin says he's fortunate for Gamecocks atmosphere
South Carolina's Frank Martin joins The Paul Finebaum Show to explain the adversity the Gamecocks' staff faced last year and how it made him more appreciative.
Steve DeMeo suing St. John's, claims June firing was due to health issue
Steve DeMeo, a former St. John's assistant basketball coach, is suing the university and head coach Mike Anderson, claiming he was fired in June because of a health issue.
Washington State men's basketball signs Kyle Smith to extension through 2026-27
Washington State signed coach Kyle Smith to a contract extension Thursday that goes through the 2026-27 season and adds two years to the original contract he was given when he was hired.