Keselowski stayed close to the leaders all night and then got the luck he needed when a late accident tightened the field and he ran strong on the two green-white-checkered laps at the end to win the NASCAR Nationwide Series Kroger 200 on Saturday night.
After the field endured a series of problems in the late laps, Elliott Sadler crashed out in lap 198 while battling Keselowski and Stenhouse for the lead, bringing out another caution and setting up the shootout to the finish.
That played to Keselowski's strength.
"It certainly was a key factor in winning the race," he said. "I knew if I could get to the front row with the short-run speed that my car had, and knowing that Ricky was kind of struggling with long-run speed, I knew that was going to be a huge deciding factor in my favor."
Keselowski had earned the pole in his previous two races but hadn't won. This time he qualified second, put himself in position to challenge, then finished.
"It was an amazing break, an amazing opportunity, and as a team, we were able to capitalize on it and close out," he said.
It was a good overall day for Keselowski, who earlier in the day qualified fifth for Sunday's Brickyard 400.
James Buescher finished second after finishing second in the Trucks Series race on Friday night.
"It was a really solid weekend," he said.
Stenhouse led more than 180 laps and threatened to run away from the field before finishing third. He led by nearly four seconds in lap 175 before an accident brought out a yellow flag.
"Coming to a short track as a driver, you really think you can make a lot of things happen, and we didn't make that last thing happen like we needed to," Stenhouse said.
Stenhouse still moved ahead of Reed Sorenson into the points lead. Sorenson finished ninth.
Action sports star Travis Pastrana was supposed to race on Saturday, but he fell at the X Games on Thursday night and broke his right foot and ankle.
NASCAR has announced that the race will move to the Indianapolis Motor Speedway next year after 30 years at Lucas Oil Raceway.
The first caution came out on lap 48.
Sadler, who started last because of a crash during qualifying, moved up into the top 10 by midrace. Through the first 100 laps, only Stenhouse and Carl Edwards had led laps, and the only caution flag had been for debris.
Stenhouse was pulling away from the field when a crash on lap 175 brought out a red flag. Annett and Tim Andrews made contact, then Steve Wallace spun and tagged both of their stationary cars on the way by. Wallace hit Annett, spun and went airborne, then ran into Andrews.
Carl Edwards was penalized for speeding in the pits while trying to edge past Stenhouse and Bayne and was sent to the back of the pack, and was in the 15th position when racing resumed. Stenhouse was in front heading into lap 184.
Bayne had mechanical problems in lap 188 while in second place, ending his quest for his first Nationwide victory.
"It blew up," Bayne said shortly afterward.
Justin Allgaier's car caught fire while he was in second place during a late caution, but he was able to get out of the car safely.
"Watching that 31 car, he was on fire for a really long time," Keselowski said. "I'm sure it was just a piece of rubber. It's unfortunate for him. That's a crazy way to get taken out of a chance to win a race."
Keselowski said he thought Stenhouse would have won if the race was a few laps longer.
"We sure weren't the fastest car, but we made it happen when it mattered, and that's what it's all about in this sport," Keselowski said.