Joey Logano used a fast car, a new line and a little luck to win Friday’s NASCAR Nationwide Series Dollar General 300 at Charlotte Motor Speedway.

Logano started third and ran in the top five all night, swapping the lead with Brad Keselowski, Ricky Stenhouse Jr. and Kevin Harvick. A late-race green-flag pit cycle left him in striking position, and a late-race shift to the high line cemented the win – his first at Charlotte and his eighth this season.

“We had to work really hard for this,” Logano said. “We weren’t the winning car at the beginning of the race. And then we made the right adjustments, and maybe by the third stop we were kind of where we needed to be. I found a line that worked for me and great strategy.”

Kevin Harvick finished second, and points leader Elliott Sadler was third.

“From a fan’s perspective, I think this was one of the best races of the year,” Sadler said. “When I was running fourth, the leaders were three-wide the whole race. These cars put on such a good show.”

Complete with late-race chaos. The final caution fell too early to allow the leaders to go all the way to the end, forcing late-race pit stops.

Logano began the cycle with 15 to go while leading the race, taking two tires and fuel. Five laps later, second-place Keselowski came in, opting for fuel only. But the team didn’t get enough fuel in the car during its 3.5-second stop to make it to the finish, forcing Keselowski back to pit lane. A bad situation got worse when Keselowski was handed a penalty for speeding on pit road, relegating him to 18th, two laps down.

“We had a car to certainly win; it just didn’t have any gas there at the end,” Keselowski said.

“You have to understand this program’s about giving opportunities … We made sure none of the Cup guys were on this team tonight so there’s no risk of getting hurt. We provided some opportunities to some other guys, and some of them did great. We had some struggles in other areas.”