AP photo by Ralph Freso / Denny Hamlin celebrates in victory lane at ISM Raceway after winning Sunday's NASCAR Cup Series race at the track in Avondale, Ariz. Hamlin will be joined by Joe Gibbs Racing teammates Kyle Busch and Martin Truex Jr. as well as Stewart-Haas Racing's Kevin Harvick in contending for the series championship next Sunday in the season finale at Homestead-Miami Speedway.

AVONDALE, Ariz. — When a critical mistake earlier this month at Texas Motor Speedway put Denny Hamlin on the verge of elimination in the chase for the NASCAR Cup Series title, the Joe Gibbs Racing driver and reigning Daytona 500 winner adamantly insisted "it's not over."

He remained undeterred, confident in his chances to win Sunday at ISM Raceway and save his season with a victory that would give him an automatic berth as one the final four drivers who will race for the title in the season finale.

He called his shot — and then he delivered.

Hamlin snagged his first spot in the championship field since 2014 with his win, a victory that eliminated 2018 Cup Series champion Joey Logano from the playoffs and gave JGR and Toyota three of the four contenders' slots in next Sunday's race at Homestead-Miami Speedway.

"I try not to put too much into it," Hamlin said. "There's still work to be done. Doesn't guarantee a championship. Gives us a chance. Live to fight another day. That's all you can ask for."

The 38-year-old Hamlin, one of the title favorites with five wins this season before Sunday's victory, faced elimination after spinning at Texas but took control at ISM and had the win essentially in the bag until a caution with nine laps remaining set up a final restart at the Phoenix-area track.

Hamlin, who had been terrible on restarts the entire race, punched his steering wheel in anger when the yellow flag waved. The JGR No. 11 team made an unusual call to take just two tires — the same strategy as fellow playoff driver Ryan Blaney — and the two lined up next to each other for the restart with three laps to go.

Hamlin finally got a decent restart, pulled into the lead and JGR teammate Kyle Busch — who had started the race in pole position — passed Team Penske's Blaney to put a buffer between the two.

Hamlin punched the air with his fist in his car as he crossed the finish line, and then he jumped into the arms of his waiting crew. Earlier Sunday he had promised them he would give his all in an effort to make the championship field.

"This race team worked so hard this whole year. They deserve to be there," Hamlin said. "I put them in a bad hole last week. I told them today in the meeting, I said, 'I'm going to give everything I've got to make up for the mistake I made last week.' That's all I got."

Hamlin will race teammates Busch and Martin Truex Jr., as well as Kevin Harvick in the Stewart-Haas Racing No. 4 Ford, for the championship. JGR drivers have won 18 races this season.

"I feel like we are all here because we worked together," Truex said.

Chevrolet will not be represented for the third consecutive season, and Hamlin's win sealed the manufacturer's championship for Toyota.

Truex won the 2018 title, Busch won in 2015 and Harvick in 2014. All three raced for the championship last season against Logano, who won the finale to snag the title from the three drivers who had dominated the season to that point. This year the final four is equally deserving of their spots in the finale — the season champion has also won the last race every year since the elimination format debuted in 2014.

Hamlin's best season finish is second in 2010, and he wound up third in 2006 and 2014, when a decision not to take tires after a late caution took him from the lead to out of contention in the finale.

"Denny has not won a championship, so you can imagine how hard he's going to go for it," said Gibbs, who has won four Cup Series titles as an owner.

Chase Elliott, Kyle Larson, Blaney and Logano were eliminated from the field of contenders. Logano's car had a mechanical problem early in the final stage that dropped him deep into the field.

"No clue. An air pressure adjustment made it go from a winning car to not able to stay on the lead lap. That sounds ridiculous," Logano said. "We'll live. Everything is going to be OK. We're still fortunate to be here and grateful to do what we love."

Elliott's championship chances ended with a crash in the final stage. He had to win after a disastrous third round of the playoffs.

NASCAR's reigning most popular driver had a mechanical problem at Martinsville, crashed at Texas and did so again at ISM when he appeared to have tire trouble that caused him to spin.

"Just a continuation of our first two weeks," Elliott said. "I feel like we were in a good position to run solid. Not sure why we had a tire go down — I think that's what happened. These last three weeks have been rough."