Logano's first career victory on the 0.75-mile oval came seemingly from nowhere after a restart with nine laps to go. He sat fourth and on the outside with Kenseth leading, Dale Earnhardt Jr. alongside in second and Gordon on the inside in third, in prime position to move underneath the leader and grab the victory.
Instead, when Gordon, Kenseth and Keselowski raced in a triangle jockeying for position, Logano went underneath all three with three laps to go and then held off Gordon for his fifth career NASCAR Sprint Cup victory.
"That's the best drive I've ever had here. What a crazy finish," Logano said.
He also joined Kevin Harvick as the only drivers with more than one victory this season.
Kyle Busch, never in contention all night, rose to finish third, followed by Keselowski and Kenseth.
Kenseth and Keselowski had words post-race, with the fuming Keselowski saying Kenseth ran him off the track.
"I had a shot at winning the race and he ran me off the track," Keselowski said. "It was just a mind-boggling move to me. ... I thought it was uncalled for."
Gordon said Kenseth was doing what he needed to do to hang on.
"I think Matt did what he thought he had to do to win," Gordon said. "He started making his car real wide. He probably didn't make the guys behind him real happy."
Kenseth had come from nowhere after lurking in the back of the top 10 all race long, suddenly charging through the field and passing Gordon to grab the lead with 38 laps to go. It was his first lead.
Gordon, who led 173 laps, and teammate Earnhardt both seemed poised to challenge at the end, but after the final restart, Team Penske teammates Logano and Keselowski became the ones to watch.
All night long, their cars had easily been the fastest on fresh rubber.
"All night long, I just had to let the 2 and the 22 go right by me because they were so fast" on fresh tires, Gordon said about Keselowski and Logano.
Signs of the wild ending may have come very early.
Clint Bowyer started third and hoped a return to one of his best tracks would allow him to put last September behind him. That was when Bowyer's intentional spin late in the last race before the playoffs jumbled the finishing order, and the drivers who made the Chase, leading to a NASCAR investigation.
Instead of a clean run, Bowyer hit rookie pole-sitter Kyle Larson on the opening lap, sending Larson spinning. He also twice pitted under a green flag, right before a caution flag came out, and was battling Danica Patrick for 38th place when a fire in his engine ultimately caused him to park for the night.