The defending Sprint Cup Series champion, who failed to qualify for the Chase this year, grabbed his first win of the season and first since Sept. 30, 2012, at Dover, by passing Kahne with nine laps to go in his Penske Racing Ford.
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 23rd.
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 re-start and fell back to seventh.
"There was a caution that shook things up," Johnson shrugged.
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. He did a hell of a job and deserves a lot of credit for it."
Kahne finished second in a Chevrolet and was followed by the Toyota of Kenseth, who takes a four-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. Then at the very end they gave me a shot to win and I'm slightly disappointed that I didn't take advantage of that opportunity."
Johnson finished 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."
Kyle Larson made his Sprint Cup Series debut driving a Chip Ganassi Racing-prepared car. He was impressive early, driving from 21st inside the top 12, and he lingered there alongside Juan Pablo Montoya, the driver he'll replace next season for Ganassi.
Larson eventually fell back and went to the garage with 87 laps remaining. He finished 37th.