Keselowski became the first non-Chase driver to win a Chase race since Kahne at Phoenix in 2011.

‘‘I never give up. I didn’t qualify well. But I kept working my way forward. I knew we had a good car,’’ said Keselowski, who started 23d.

The race changed dramatically with 27 laps remaining and Jimmie Johnson seemingly on his way to an easy victory, but a debris caution sent the leaders to pit road and ended Johnson’s march to a record seventh Charlotte win.

Hendrick teammates Kahne and Jeff Gordon took only two tires and raced off pit road first, while everyone else took four tires and lined up behind them. Johnson came out in third, and should have been in good shape on four fresh tires. Instead, Johnson had a terrible restart and fell back to seventh.

‘‘There was a caution that shook things up,’’ Johnson said with a shrug.

Kahne pulled away with the rest of the leaders. Championship leader Matt Kenseth was in the mix for a moment, but Keselowski, sixth on the restart, got past him and took over second.

Keselowski then set his sights on Kahne once and for all. He had picked his way through traffic but getting past Kahne wasn’t easy — Keselowski needed several attempts before making it stick.

‘‘I love hard racing and there are a handful of guys who can’t race hard and they freak out — he’s not one of them,’’ Keselowski said about Kahne. ‘‘He’s an excellent driver. He ran me hard, but ran me clean and that is great racing.’’

Kahne finished second and was followed by Kenseth, who takes a 4-point lead over Johnson into next week’s Chase race at Talladega.

‘‘I’m happy we finished third,’’ said Kenseth, who was the lowest qualifying Chase driver at 20th. ‘‘I was so far behind because I qualified so poorly and needed all night to get back up there.”

Johnson wound up fourth and said he had trouble when he tried to push teammate Kahne on the restart.

‘‘Evidently I was too close to him and in his way, and my car washed up a little bit,’’ Johnson said. ‘‘A couple of guys were able to get inside of me. I just lost track position at that point, which was unfortunate. Once I got rolling again I was fine, but I lost too much at that point.’’