Gordon grabbed the lead from Kenseth with 12 laps left and held on for an 0.6-second triumph in the seventh race in the Chase for the Sprint Cup Championship.
The win was the 88th career Sprint Cup title for Gordon but his first since the 2012 event at Homestead. It was also his first win at Martinsville since 2005.
Kenseth used his second-place finish to forge a tie with Johnson atop the Chase standings with three races left. Each driver has 2,294 points.
Gordon vaulted from fifth to third, finishing the day 27 points behind the co-leaders.
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'
Benedict Cumberbatch's dramatic reading of R. Kelly lyrics is just what you need