Kahne took the lead from Hamlin during a restart on the 240th lap of the 300-lap race at the one-mile New Hampshire Motor Speedway on Sunday. The winner was helped by miscommunication between Hamlin, who wanted two tires changed, and crew chief Darian Grubb, who thought he wanted four.

That longer pit stop left Hamlin all the way back in 13th place, but he kept passing cars until only Kahne remained in front. Kahne stayed ahead and won by about 10 car lengths.

It was Kahne’s 14th win of his career and first since May 27 at Charlotte. Clint Bowyer, Dale Earnhardt Jr. and Brad Keselowski rounded out the top five.

The win enhances Kahne’s chances of qualifying for the Chase, the last 10 races of the season in which the top 10 drivers in the point standings win automatic berths. Two additional spots go to the drivers with the most wins who are ranked 11th to 20th in points. Kahne began the day in 16th place, but his two wins are more than anyone in the second group of 10.

“We’ve been pretty tough all year, but we just haven’t finished ‘em off a lot of the times,” Kahne said. “From here on out, we need some more top 10s and top fives the rest of the way. It doesn’t get us in the Chase yet, but it does help with a win today.”

The turning point came when the third caution flag came out on the 234th lap for oil dropped on the track by David Reutimann.

Hamlin went into the pit, telling Grubb over the radio that he wanted tires. Grubb, who first planned to change just two, interpreted that to mean four. As Hamlin went back on the track, Grubb told him, “My bad, bud.”

And after the race, Grubb took the blame: “That was 100 percent my fault.”

Hamlin’s Toyota was the best car in the race, which enabled him to pick off one car after another as he recovered from the error.

“It’s such a team sport,” he said. “We just had a slight miscommunication and that one little miscommunication will magnify it.”

Kyle Busch, the pole-sitter, led the first 66 laps before his own costly pit stop. It took longer than usual as his crew had a problem with the right tire. Then there was more trouble — a drive-through penalty against Busch for entering pit road too fast. When he finally returned to the track, he was all the way back in 22nd place.

“No emotion right now. No emotion,” he told Busch over the radio. “One hundred percent driving talent. Long way to go. Just chip away, one by one.”

Busch finished 24th.

Busch’s teammate, Hamlin, took over the lead from Busch after that problem.

The first caution of the race came on the 90th lap to clear debris from the track. All the drivers on the lead lap made pit stops except for Jeff Gordon, who went in front.

But through 100 laps Busch had climbed all the way up to ninth while Hamlin, Gordon, Jimmie Johnson, Kahne and Earnhardt held the top five spots. The last four all drive for Hendrick Motorsports.

Sprint Cup points leader Matt Kenseth finished 13th and has won just once this year — in the season-opening Daytona 500 in February.

Sam Hornish Jr., replacing the suspended AJ Allmendinger, came in 22nd. Allmendinger was suspended about 90 minutes before the race at Daytona International Speedway last weekend after a urine sample taken the previous weekend at Kentucky Speedway came back positive for what his team identified only as a stimulant. His “B’’ sample is to be tested, probably this week, with his toxicologist present.