For a long stretch on Sunday afternoon, it looked as if the Folds of Honor Quik Trip 500 at Atlanta Motor Speedway was going to set the record as one of the more lackluster events in speedway history.

But the final quarter of the race produced one dramatic development after another. Brad Keselowski won. But it’s complicated.

Kevin Harvick, who dominated the race, leading 292 of 325 laps, saw victory slip away in recent Super Bowl fashion when he was nabbed for speeding on pit road on his final stop.

Chase Elliott, who had shadowed Harvick for most of the day, appeared poised to capitalize on Harvick’s mistake, but his No. 24 crew, which had been stellar all afternoon, had a brief stumble of their own that essentially took him out of contention.

That put Kyle Larson in the lead with 11 laps to go, but he wound up losing the top spot to Keselowski, who then appeared to have lost his chance to win due to another mistake by his crew on the previous stop.

Keselowski exited the pits ahead of Harvick, but his team, using cameras on the tire changers’ helmets, determined that his wheels had loose lug nuts. That required an additional pit stop and dropped him from the lead to 14th place with a little over 50 laps to run.

But Keselowski worked his way back to the front and with seven laps remaining, he motored by Larson to get the victory. Larson took second place over Matt Kenseth, Kasey Kahne and Elliott. Harvick recovered to finish ninth.

Keselowski pointed out that no race is won or lost until the checkered flag.

“You never know,” he said. “That’s how these races are.

“We had a lot of adversity. There’s no doubt about that. These races aren’t easy. They’re 500 miles and a lot can happen and when you think you’ve got it, they slip away. I know how it goes. This one kind of fell in our lap at the end and my team put it all together when it counted.”

NASCAR race outcomes often are heavily influenced by events on pit road, but it’s rare for pit-road speeding penalties to be such a big factor. There were 13 of them on Sunday involving 11 drivers, but Harvick’s easily had the most impact on the outcome.

For him, the disappointment was hard to hide.

“I’m so sorry guys,” he radioed to his crew as he headed to pit road after the race.

Afterwards, he said he was surprised by the penalty.

“I didn’t think I was pushing it that close,” Harvick said, adding that the penalty was hard to take considering that he knows better. “To make a petty mistake that I always preach against, that what hurts so much.”

For Elliott, the race was another he came close to winning but he could not land that elusive first Cup win. He ran second and third behind Harvick for most of the race, but was unable to capitalize when Harvick was caught speeding.

Elliott, who recovered from an early pit-road speeding penalty of his own, was running second when a final caution flag flew. He lost three spots on pit road and wound up having to restart in the outside line, which is a distinct disadvantage at AMS.

He recovered to finish fifth, but that seemed to be little consolation.

“Obviously frustrated,” Elliott said. “I thought our car was as good as Kevin’s car was. I just think he did a little better job driving than what I was doing. I thought we could run second to him.

“The majority of the day, I thought Brad [Keselowski] at times was a little better than us. At times, I thought we were a little better than him and on that last stop, we had just a little bit of a hiccup that lost us second spot unfortunately. And after Kevin’s misfortune, that would have put us in a really good spot.”

He said he didn’t blame his crew.

“I think we have a great foundation on pit road to build off of,” he said. “I think much improved and just had a hiccup there at the end of the day. But I don’t think it’s something those guys should be discouraged over.”

Harvick, the pole-sitter, did get somewhat of a consolation prize: he won the first two segments of the race. He led 82 of the first 85 laps to win the first stage, which ran caution-free. Elliott was third in the segment behind Harvick and Keselowski.

Harvick dominated the second stage as well and ended the segment more than five second ahead of Elliott in second place.

The race was also a victory for the speedway as the March weather was more like May and the turnout of fans, while nowhere near a sell-out, appeared to be significantly higher than in recent years.