MADISON, Ill. (AP)Joey Logano watched helplessly as Kyle Busch drove away from him on a late restart Sunday, seemingly ending his hopes of delivering a much-needed win for Team Penske in the NASCAR Cup Series debut at World Wide Technology Raceway.

Kevin Harvick’s wreck with five laps left gave Logano another chance.

He took advantage of overtime, too, winning a drag race with Busch into the first corner in overtime, then jockeying briefly for the lead, before pulling away to take the white flag and eventually Logano’s second win of the season.

”It doesn’t get much better than that, racing for the lead like that with Kyle, one of the best, crossing each other back and forth,” said Logano, who made it a banner day for Team Penske, which won the IndyCar race with Will Power earlier in the day in Detroit. ”I knew it was coming. I did it to him. I knew he was going to do it to me.”

The victory must have felt even sweeter for Team Penske given its recent struggles. In the last five points races, Logano has the only top-10 finish for the entire team with his victory last month at Darlington.

Kurt Busch finished second Sunday with Logano’s teammate, Ryan Blaney, in fourth and Aric Almirola in fifth.

”I’m way out of breath here,” Logano said. ”What a great car. Really fast.”

Ross Chastain was fast all day, too; he just couldn’t stop hitting people. He got into Denny Hamlin and Chase Elliott at different points in the race, leading both of them to retaliate on the track.

”It was terrible driving,” Chastain said afterward. ”It’s one thing to do it once. I kept driving into guys. At this level I have to be better than that. It’s a shame. I had all these people believing in me. They deserve better.”

By the end, Logano had watched Kyle Busch drive away on a restart with 13 laps remaining, only to get a reprieve when Harvick crashed with five to go. That led to a green-white-checkered finish at the 1 1/4-mile hairpin east of St. Louis, where Busch chose the outside lane as Logano drove his No. 22 car to the inside once again.

This time it was Logano that won the race to Turn 1 and moved in front of Busch, who crossed him over and took the lead into the sweeping third and fourth turns. That’s where Logano went low and pulled ahead, gaining the space he needed to pull away when Busch got a little sideways coming out of Turn 4.

”We stayed in the running all day and fought hard,” Logano said, ”and thought maybe we could, and that was it.”

The first Cup Series race at World Wide Technology Raceway, nestled just across the Mississippi River from the Gateway Arch and downtown St. Louis, produced a thrilling throwback to the early years of NASCAR, when tempers in the cars ran just as hot as the temperature outside – it soared over 90 degrees Fahrenheit in the sun.

Chastain had a lot to do with it.

The trouble for the eighth-generation watermelon farmer began in Stage 2, when Chastain ran up on Hamlin’s rear coming out of the tight first and second turns and sent the No. 11 into the outside wall.

”I owe half the field an apology and words aren’t going to fix it,” Chastain said. ”I’ll have to pay for it on the track.”

Indeed, Hamlin spent the rest of the afternoon trying to get even: He nearly drove Chastain down onto the grass down the back stretch, then slowed to a crawl around the track and nearly kept him from making the minimum speed.

”It’s good he takes responsibility but ultimately it ruined our day,” Hamlin said. ”I think we were racing hard there for a while on the inside. He tried to keep sliding up in front of us and wasn’t able to because I wasn’t willing to just back off and let him slide up front. It didn’t take long before he tucked behind us that he wrecked us.”

Hamlin wound up with some support when Chastain got into Elliott’s quarter panel later in the stage, spinning him out. And when the race resumed, Elliott nearly nudged Chastain into the wall before Hamlin took another swipe at him.

All the drama kept a sellout crowd of more than 60,000 on their feet in the blistering afternoon sun. Chastain wound up finishing seventh, Elliott was 21st and Hamlin finished 11 laps down in 34th place.

”We all have learned the hard way. We’ve all had it come back around on us,” Hamlin said, ”and it’ll be no different.”

FRONT TO BACK

AJ Allmendinger won the Xfinity race Saturday in Portland, Oregon, then flew to St. Louis to start at the rear of the field Sunday. Ben Rhodes was supposed to qualify his No. 15 for Kaulig Racing but crashed in Turn 3 during practice and did not make an attempt. Allmendinger drove through the field to finish 10th.

ZANE-Y DEBUT

Zane Smith, who was ninth in the Truck Series race Saturday, made his Cup Series debut in place of Chris Buescher, who tested positive for COVID-19 earlier in the week. Smith drove the No. 17 to a 17th-place finish for RFK Racing.

MILESTONE MOMENT

Martin Truex Jr. became the 32nd driver to make 600 starts in the Cup Series when he took the green flag. His first came at Atlanta on Oct. 31, 2004, for Dale Earnhardt Inc. The 2017 series champion finished sixth in Sunday’s race.

UP NEXT

The Cup Series heads to the road course at Sonoma in California’s wine country next Sunday before taking a week off.

More AP auto racing: https://apnews.com/hub/auto-racing and https://twitter.com/AP-Sports