AMES, Iowa (AP) -- With the NCAA tournament just about a month away, teams are going to lean on their stars more than ever.
Ejim scored 25 points, DeAndre Kane added 22 and Niang had 20 to help No. 17 Iowa State beat 19th-ranked Texas 85-76 on Tuesday night for its fifth victory in six games.
The trio shot 57 percent from the floor to lead the Cyclones (20-5, 8-5 Big 12), who became the third-fastest team to 20 wins in school history.
''It's obviously important that your key guys are playing well for you,'' Hoiberg said. ''Even though those guys all scored over 20, I think it was a total team effort.''
Iowa State outscored Texas 25-12 late in the second half to pull away and move within a game of the second-place Longhorns in the Big 12.
The Cyclones were keyed by Ejim, who had his second-best scoring game of the season, while Kane chipped in with five assists and zero turnovers and Niang helped keep Cameron Ridley without a field goal.
Isaiah Taylor had 26 points to lead the Longhorns (20-6, 9-4), who've followed up a seven-game winning streak by splitting their last four.
''They didn't do one thing that we didn't think they'd do. We weren't tough enough to guard it, stop it,'' Texas coach Rick Barnes said. ''We didn't come in with a tough enough mindset to start the game.''
But even though Texas shot just 33 percent from the floor, it still hit some big shots in the second half.
The Longhorns could barely miss from the line either.
Javan Felix hit a 3 to match a crowd-energizing one from Matt Thomas, and Connor Lammert did as well with Iowa State on the verge of going ahead by double digits with 8:08 left.
Texas also hit its first 16 free throws and 23 of 25 overall to hang close. But Jonathan Holmes finally missed with 6:26 left, and Niang's ensuing putback gave Iowa State a 75-65 lead.
Felix had 16 points, but he needed 22 shots to get there.
''Coach (Hoiberg) preaches poise and resolve. I think when they were hitting big shots we'd just come down and try and make a play again. I think that was huge. We ended up getting some stops to help get the lead up,'' Niang said.
Holmes and Ridley, who combined for 39 points and 18 rebounds in an 86-76 Texas win over Iowa State last month, teamed up for just 18 points and 14 rebounds on Tuesday.
Iowa State also outscored Texas 40-18 in the paint despite a 44-35 deficit on the boards.
''Even though they beat us on the glass, we got them when it was crucial. We got them at important times. There was a lot of toughness shown by our team,'' Ejim said.
The Cyclones had struggled of late on defense. They let up 102 points in a loss at West Virginia on Feb. 10 - and followed that up by blowing an 18-point home lead against Texas Tech.
Iowa State's first defensive stand against the Longhorns was a disaster.
It got better from there, though.
The Cyclones allowed four consecutive offensive rebounds by Texas to open play, and Kane went to the bench with a neck injury. But Kane returned in time to hit Iowa State's first basket, and the Cyclones soon took a lead it would hold for most of the half.
Monte Morris found Ejim for an alley-oop to help Iowa State push its lead to 36-27, and his reverse dunk from the baseline made it 43-33. But Texas, which shot a dreadful 10 of 37 from the floor in the first half, hit six of their next 10 to pull even at 48-all with just over 14 minutes to go.
The Longhorns didn't have an answer for Ejim though - and Kane and Niang also had their way with the Texas defense.
''It wasn't a real sweet talk at halftime. But I do think they came out and responded. Then, when we tied it at 48 in the second half, we weren't smart enough,'' Barnes said.
Follow Luke Meredith on Twitter www.twitter.com/LukeMeredithAP