LOUDON, N.H. — Tony Stewart almost crashed the Toyota party.

On a Sunday in which Toyotas led all but two laps of the New Hampshire 301, Matt Kenseth, in one of the Toyotas, won the race with Stewart filling up his rear view mirror over the closing laps.

Stewart was mostly an afterthought for most of the race as Kenseth and his Toyota colleagues battered the rest of the field, with Kyle Busch leading 133 laps, Martin Truex Jr. 123 and Kenseth 38.

But the race’s landscape changed dramatically over the final 30 laps as a series of caution flags jammed the field and cut into the Toyotas’ ability to build significant leads.

With three restarts in the final 25 laps, Kenseth had to stay on his toes. There were three separate accidents behind him on those restarts, shredding the field of contenders.

“Every restart you’re just hoping not to mess up and spin the tires too bad,” Kenseth said. “Thankfully, we had good ones, and we had great power and we had good traction, and we were able to get going pretty good in a straight line. Then after a couple laps we were able to roll the middle and get away.”

NASCAR announced after the race that Kenseth’s winning car had failed post-race inspection at the sanctioning body’s laser inspection station. The car will be examined at NASCAR’s Research and Development Center in Concord, N.C., and penalties might be announced by mid-week.

By race’s end, Busch and Truex had fallen back from the top five, and Stewart, showing new life as the Sprint Cup schedule races through the hottest part of its schedule, had steadily zipped through the field to battle with Joey Logano for second — a test he won. The gap to Kenseth was too big, however, and Stewart finished second by 1.9 seconds.

Logano was third, Kevin Harvick fourth and Greg Biffle fifth. Busch fell back to eighth, and Truex, who appeared to be on the way to his second win of the season for much of the afternoon, came home 16th after clutch problems left him with only fourth gear, putting him at a major handicap on restarts.

The win was the second for Kenseth this year and gave Toyota its ninth victory – almost half of the races to date.

The tour’s Toyota contingent appears to be setting up well with the start of the Chase looming only a few weeks away, but Kenseth was in the moment Sunday at Loudon.

“I haven’t spent two seconds thinking about the Chase,” he said. “I think these are all big races. I was looking forward to race here. This used to be one of my worst places. Now I feel like it’s one of our better.”

Stewart, who won June 26 at Sonoma, Calif., to virtually lock in a spot in the Chase in his final season as a driver (as long as he can remain in the top 30 in points until the end of the regular season), leapfrogged through the field over the closing miles to further re-establish himself as a driver to be reckoned with as the tour heads to Indianapolis Motor Speedway, his home track, next weekend.

“What do I have to lose here?” Stewart said. “I don’t have anything to lose. We’re going to get everything we can get out of it and take whatever we can get. We’re going to fight and claw and scrape like everybody else.

“We’re dishing out what we’ve been taking for a while. The guys who’ve been leaning on us, we’re leaning on them. I think they know we mean business.”

With 11 drivers having scored victories, there is the possibility that five Chase spots will be determined by points. Chase Elliott, Ryan Newman, Austin Dillon and Jamie McMurray currently hold the first four of those positions.

Dale Earnhardt Jr., who missed Sunday’s race while he recovers from concussion-like symptoms, currently is in the fifth spot but could fall out of Chase points contention if he is sidelined for another race.