KANSAS CITY, Kan. (AP) — Ross Chastain took the lead from Martin Truex Jr. on a late restart and won the NASCAR Cup Series race at Kansas Speedway, where just about everyone still alive in the playoffs had to overcome problems to make the most of their Sunday.

William Byron was unable to chase down Chastain after he took the lead with 20 laps to go, though the Hendrick Motorsports driver still wound up with the best finish among the 12 to qualify for the second round of the postseason. Chastain celebrated his first win of the season with his trademark watermelon smash on the front stretch. “We've been building on this,” he said.

“We didn't qualify the best this weekend but we won the race.” The retiring Truex, who was eliminated last week at Bristol, finished third in what was his last race at Kansas. Ryan Blaney had a loose left wheel in the final stage but rallied to finish fourth, giving the defending champion's postseason hopes a big boost.

Ty Gibbs was fifth, followed by four more playoff contenders. William Byron was sixth, pole sitter Christopher Bell recovered from a couple of scrapes with the wall to finish seventh, Denny Hamlin salvaged an eighth-place finish after two problems on pit road, and Chase Elliott was ninth after starting at the rear of the field due to an engine change. “Considering yesterday and starting last and everything, it could have been a lot worse,” Elliott said.

“But I'm always on the side of the fence where our car was good eno.