Denny Hamlin won the NASCAR race at New Hampshire on Sunday, getting the mistake-free trip he needed to win for the series-leading fifth time this year.

Jimmie Johnson finished second and took the lead in the Chase for the Sprint Cup.

Jeff Gordon was third.

Hamlin’s crew avoided the mistakes that dogged them during a tire change here in July and in Chicago last week, when he ran out of gas. On Friday, Hamlin had another setback when his crew had the wrong pressure in his tires and he qualified 32nd.