When two races were left in the Sprint Cup circuit’s regular season, it looked as if Kasey Kahne might be the only Hendrick Motorsports driver not participating in the Chase for the Sprint Cup, the 10-race run to the title that begins after Saturday night’s regular-season finale at Richmond International Raceway.

But on Sunday night at the Oral-B USA 500 at Atlanta Motor Speedway, Kahne came through in the clutch, surging ahead on the second try at a green-white-checkered-flag run to the finish, winning the race and joining his Jimmie Johnson, Dale Earnhardt Jr. and Jeff Gordon in the prestigious Chase.

The driver Kahne beat at the end, Matt Kenseth, finished second despite having only two fresh tires at the end while most of his competitors had four, also secured one of the 16 berths based on his position in the points standings.

Three spots remain up for grabs after the Richmond race. Ryan Newman, Greg Biffle, Clint Bowyer and Kyle Larson are in the running for those spots, but should a new winner emerge, only two of them will qualify for the Chase.

For much of Sunday night’s race, which ran before a relatively large crowd in the grandstands for the final Labor Day weekend race before the date shifts to March 1 next year, the story appeared to be another runaway win by Kevin Harvick, who dominated the track’s Nationwide Series race on Saturday night and led a race-high 195 laps on Sunday.

But on a restart with 25 laps of the scheduled 328, Kahne surged past Harvick and drove out to a fairly commanding lead. He appeared to have victory within his grasp with two laps remaining when Martin Truex Jr. and Kyle Busch collided, bringing out the caution flag. The leaders all headed to pit road for fresh tires for the green-white-checkered flag run to the finish.

Kenseth and Paul Menard took the top two spots by taking just two tires, while Kahne lined up in the third row behind Denny Hamlin and Harvick. On the ensuing restart, Menard stumbled, collecting Harvick and setting up another try at a two-lap dash to the finish.

When the green flag dropped for the final time, Kahne, who had moved to third for the start, soon wrestled the lead from Kenseth and took the win by .054 seconds over Kenseth, Hamlin, Jimmie Johnson and Carl Edwards.

Kahne said he knew his best shot to make the Chase was winning at Atlanta, where he now has three career Cup victories. “I just kept saying, ‘I have to win. I have to win Sunday night,’” he said. “It was all that I could think about. I knew Atlanta was a better opportunity for myself to win than at Richmond.”

Danica Patrick finished a Cup-career-best sixth.

“It was a tough race,” Patrick said. “Man, that race felt like it was 700 miles.”

Tony Stewart, returning to racing for the first time since an Aug. 9 incident in which sprint car driver Kevin Ward Jr. died after contact with Stewart’s car at Canandaigua Motorsports Park in New York, had a strong run going in the early laps. But just after a restart at Lap 123, he was forced into the wall by a sliding Kyle Busch, and the damage to Stewart’s No. 14 Chevrolet led to several trips down pit road and eventually a blown tire and crash that ended his night early.