The victory, Logano's second of the season, fifth of his career and first on a short track, locked him into the Chase for the Sprint Cup. Gordon's second-place finish allowed him to hold onto the series points lead.
"It feels great. I want to start winning some races in the Chase now," Logano said. "These cars right now are so good and (Team) Penske is doing such a great job with these cars right now. I am just the lucky guy that gets to drive these things."
I am just the lucky guy that gets to drive these things.
Gordon, although unable to win, was pleased with his evening.
"I had a blast tonight," said the four-time champion, who started 25th. "Great short-track racing here at Richmond. And to have a race car like that to drive from 25th up to the front was so much fun."
It was a wild night from start to finish.
Things got ugly early, as pole sitter Kyle Larson found himself dumped by Clint Bowyer going into the first turn on the opening lap.
When the race restarted, second qualifier Keselowski led Bowyer, with Larson all the way back in 43rd. Keselowski, the 2012 series champion, dominated the early going, leading 76 of the first 100 laps.
Then Gordon took the lead on pit road on Lap 103, when a 16.5-second stop briefly dropped Keselowski to fifth.
On Lap 163, the right front of Bowyer's car erupted in a ball of fire, melting the right-front corner of his Michael Waltrip Racing Toyota.
Just after the restart, Keselowski passed Gordon for the lead on Lap 173 and quickly pulled Logano into second with him. At the halfway mark, Lap 200, the two former champions were only about half a second apart, Keselowski leading Gordon.
Gordon went back out front on Lap 209, diving underneath Keselowski to make the pass.
After a caution when Reed Sorenson's car went up in an inferno of flames, the race restarted on Lap 239. Four laps later, Logano passed Gordon for the lead. But it was short-lived, as Gordon re-took the point on Lap 252 ahead of Logano and Keselowski.
Meanwhile, on Lap 280, Earnhardt motored past Logano to take second place.
Sixteen laps later, Ricky Stenhouse Jr. hit the wall after a right-front tire blew, as his car caught fire, too. Under the ensuing caution, Earnhardt took the lead with a 12.0-second pit stop to Gordon's 12.2. But when the green came out, it was Logano and Keselowski who took the top two spots.
Gordon passed Keselowski for second on Lap 332, with Earnhardt moving to third just two laps later.
And on Lap 338, Gordon went under Logano going into Turn 1 and back into the lead. Earnhardt got second on Lap 340, making it a Hendrick 1-2.
Kenseth took second on Lap 354, dropping Earnhardt to third.
Quickly, Kenseth caught Gordon, taking his first lead of the evening on Lap 362.
Jimmie Johnson lost a right-front tire to bring out a caution on Lap 369. Kenseth won the race off pit road, with Gordon slowing at the exit, allowing Earnhardt to restart second and Gordon third, on the preferred inside line right behind Kenseth.
The race restarted on Lap 377, with Denny Hamlin getting spun out by his Joe Gibbs Racing teammate Kyle Busch to bring out another yellow.
Kenseth was still out front, ahead of Earnhardt, Logano, Gordon and Ryan Newman when the green waved on Lap 383. Logano got a bad jump, allowing Gordon to retake third place.
But with 15 laps to go, J.J. Yeley brought out another caution when his engine blew.
Kenseth held the lead when the track went green with nine laps to go, but a four-way fight for the lead broke out among Kenseth, Gordon and the two Team Penske Fords.
After a lot of furious dicing for the top spot, Logano passed Kenseth with four laps left to win, Gordon moving into second and Kyle Busch making a late-race charge to third place.
"The 20 (Kenseth) started blocking the top because the 2 (Keselowski) car was so fast up top for the first 10 laps of a run and eventually I had enough room to turn up underneath him and get enough clean air on the car to take off," Logano said. "This isn't a very good race track for me in the past but we had a really good Shell Pennzoil Ford today and we were able to put it in Victory Lane.
"Joey was in the right place there," Gordon said. "He had a good short-run car."
After the race, Keselowski was mad at Kenseth for blocking him during the final run and Marcos Ambrose and Casey Mears traded punches in the garage as well.
In other words, it was some good, old-fashioned Saturday night short-track racing, NASCAR-style.