WATKINS GLEN, N.Y. (AP) Denny Hamlin wasn't about to get shoved aside again.
Ignoring what he described as the worst pain he has ever felt in a race, Hamlin prevailed in a four-lap dash to the checkered flag Sunday to win the wreck-filled Sprint Cup race at newly paved Watkins Glen International.
It's the first road course win of Hamlin's Cup career and atoned for his stunning loss on the road course at Sonoma in June, when he was beaten by Tony Stewart with a bang on the last turn.
''It's very hard to win these races,'' Hamlin said. ''I only made one mistake at Sonoma, and I didn't win.''
Hamlin was virtually flawless at The Glen and was able to conserve enough fuel at the end, thanks to eight cautions for 20 laps. The race also had two red flag stoppages for 30 minutes.
''We executed perfectly. Didn't make any mistakes on pit road,'' Hamlin said. ''Hoping for those caution laps that we needed. That allowed us to make it on fuel.''
That Hamlin was behind the wheel of the No. 11 Joe Gibbs Racing Toyota was in doubt before the race. He was in pain when he awoke.
''Knew I was in pretty big trouble,'' said Hamlin, who has undergone two knee surgeries in his career. ''I was thinking under the (last) red flag let's get this over with so I can get out of this car.''
The race was shaping up as another duel between Brad Keselowski and Kyle Busch in the closing laps. But a rash of late cautions shuffled Busch back.
Keselowski restarted with the lead with 25 laps to go in the 90-lap race, and Busch stalked him in second as the leaders began turning the fastest laps of the race around the 2.45-mile layout with the end in sight.
The sixth caution flew on lap 78 for a blown engine and erased a 5-second lead the two leaders had built over Hamlin, Martin Truex Jr. and Joey Logano, who was seeking his second straight sweep of the Cup and Xfinity races at The Glen.
Keselowski lost the lead on the restart when both he and Busch overdrove the first turn, a 90-degree downhill right-hander, and Hamlin sneaked past to take the lead before another caution flew.
''When I saw them move forward and lunge into the corner, I knew there was no way for them to get out with any sensible speed,'' Hamlin said. ''It was my opportunity.''
Hamlin held a slim lead over Truex and Keselowski as the three ran nose-to-tail entering the final turns of the race. Keselowski spun Truex in the last turn and Hamlin coasted to the victory.
Logano finished second, and Keselowski, AJ Allmendinger, Stewart and Busch completed the top six.
''We got ourselves in position to win the race, but I didn't have the speed to make it happen,'' Logano said.
Jeff Gordon drove the No. 88 Chevy for Hendrick Motorsports in relief of Dale Earnhardt Jr. for the third straight race and finished 14th in his 800th career start after an early accident. Earnhardt is recovering from a concussion and will miss at least two more races.
Other things of note from Sunday's race:
BUESCHER SURVIVES: Despite a pit road penalty and a late crash, Chris Buescher remained on the cusp of making the Chase for the Sprint Cup title despite finishing 30th, one lap down. The surprise winner last week in the rain at Pocono came to Watkins Glen six points outside the top 30 in points, a requirement for making the postseason Chase, and now trails David Ragan by three points. Ragan also was involved in a crash and finished 33rd.
''You know, for us, kind of hoped we'd get a lot more than what we did,'' Buescher said. `It's a bummer the way it worked out.''
INFRACTIONS, INFRACTIONS: NASCAR increased the number of timing lines on pit road at Watkins Glen from six to 14 this year, and it ended up costing a lot of drivers a lot of time. Of the 31 infractions handed out, seven were for speeding. A tire out of the pit box was costly for pole-sitter Carl Edwards. He led the first 25 laps, suffered the penalty on his first pit stop, and finished 15th after getting spun in an altercation with Ragan and Clint Bowyer.
THE CRASH: There were two more crashes coming out of the sweeping Carousel turn coming to the backstretch. The big one came when Ricky Stenhouse Jr. lost control of his No. 17 Ford coming out of the sweeping right-hander and skidded across the track. Jimmie Johnson slammed hard into Stenhouse, and Greg Biffle and Austin Dillon also were involved. Johnson finished last.
THAT CROWD: While most NASCAR venues don't attract the crowds they used to, Watkins Glen, with its fantastic finishes, remains an exception. The track announced its second straight grandstand sellout. Although attendance figures aren't released, the crowd estimate was just under 100,000.
''I'm sure the fans loved it,'' Logano said. ''It was pretty cool when I pulled over for the red flag in front of the grandstands and I could hear just fans screaming and yelling and loving it. I thought, `Man, this is really cool to be in the driver's seat right now.' "
UP NEXT: Night race at Bristol on Aug. 20. Logano is the defending winner.
Follow Kekis on Twitter: www.twitter.com/Greek1947