LOUDON, N.H. — The best car was rolling toward victory — until its driver and crew chief couldn't agree on how many tires to change.

Kasey Kahne capitalized on that confusion between Denny Hamlin behind the wheel and Darian Grubb in the pits to win his second Sprint Cup race of the year and make a leap toward one of the 12 spots in the Chase that determines this year's NASCAR champion.

"For those guys to miscommunicate, that helped us a ton," Kahne said. "I'll take 'em any way we can."

Hamlin's Toyota led for 150 of the 300 laps at the one-mile New Hampshire Motor Speedway on Sunday. His communication wasn't quite as good.

Kahne, who finished second two weeks ago at Kentucky to Brad Keselowski, went ahead to stay during a restart on the 240th lap when Hamlin spent extra time in the pits as his crew changed all four tires.

Hamlin wanted just two new ones.

"Darian asked me how much of the tires I felt I'd used up. I felt like I had used up a substantial amount," he said. "(I said) give me tires and no adjustments. He thought I meant four tires. Nothing's a given. Even though it looked like we had one in the bag if we took two tires, you never know."

Kahne doesn't feel he stole a victory.

"I wouldn't say 'stolen.' We ran in the top four the whole race," he said. "We were in pretty good shape, (but) if he was to keep the track position I never would have passed him."

Hamlin's longer pit stop left him all the way back in 13th place, but he kept passing cars until only Kahne remained in front. Then he simply ran out of miles and Kahne won by 2.738 seconds.

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

The victory enhanced 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 went from 16th to 12th, and 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."

After the race, Grubb took the blame: "That was 100 percent my fault."

And Hamlin knew how costly the mistake was.

"You try to be optimistic, but you pretty much know your chance of winning has been pretty much taken away if there are no cautions," he said. "Darian has won me a couple of races this year, more than he's taken away from me."

The win was the fifth of the year for Hendrick Motorsports in 19 races. Seven remain before the Chase begins at the Chicagoland Speedway in Joliet, Ill., on Sept. 16.

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.

Busch finished 16th.

Hamlin, Busch's teammate with Joe Gibbs Racing, took over the lead after that problem.

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.

Kahne should have a more relaxing week. With no Sprint Cup race next weekend, he has time to savor his win, no matter how he got it.

"We did it with good pit strategy, got the track positions," he said, "and we were able to lead those final laps."