Denny Hamlin rode into history Sunday afternoon with his come-from-behind victory in the STP 400 at Kansas Speedway.

Hamlin won in the No. 11 Joe Gibbs Racing Toyota, scoring the 199th Sprint Cup victory in NASCAR history by drivers piloting cars numbered 11. That car number owns the all-time record as Hamlin’s win broke a tie with the iconic No. 43, which has been carried to 198 wins – 192 by Richard Petty.

Hamlin’s 19th career victory was tougher than most. Martin Truex Jr. was virtually unstoppable all day until his car developed a loose condition on the final run of the day, giving Hamlin the opening he needed.

Hamlin shot to the lead by passing Truex with 31 laps to go, scoring his second win of the season and heightening the buildup as he goes “home” to race at Richmond International Raceway next weekend.

Hamlin had led only one lap early in the race before storming past Truex, who led 173, with 31 to go. Truex battled a very loose car over the closing miles and couldn’t pass Hamlin despite some desperate moves near the end of the race.

It was one Toyota against another as Hamlin tried to score his second win of the year and Truex tried to win for the first time since 2007.

“You know, at the end it's a no lose situation for myself because I'm a fan of Martin's, I'm a fan of (team owner) Michael Waltrip, and they've really done some great things with that program,” Hamlin said.

“But my job is to win for my guys and really drive as hard as I can to get them those wins because they're so hard to come by now that you have to just do everything you can. And I knew that he was driving his heart out as well as I was driving mine.

“Once I got to the lead, I felt like I got a little bit complacent mainly on corner entry, just being careful. But what got me the lead was driving hard, and so I needed to get back to that, and that's kind of where we were able to stretch it out. But it was a good day for Toyota because Michael Waltrip Racing and Joe Gibbs Racing have got a bond that's working better and better together obviously with the common engine package and everything, so we're starting to see these Toyotas start to make a run.”

Hamlin said he and Truex ran generally the same line on the track virtually the entire race, a circumstance that benefited Hamlin near the end of the event because Truex couldn’t make up the deficit using a different line.

“We were both running right around the wall,” Hamlin said. “I knew that the only advantage that I had is when his car got so loose that last run, I was able to make up a lot of time on entry and a lot of time on exit because he was really fighting his car.

“So, really, as the driver behind you can manipulate his car and make it worse for him by getting up close to him, and that's what I kind of did a few laps leading up to when we passed him is that I tried to run as close up to him on entry as I could and as close on exit. So it takes away rear grip, and to a car that was as loose as what his was, they have no choice really but to back off and not wreck their car.”

Hamlin moved to fifth in the point standings with the win and joined Tony Stewart as the tour’s only two-time winners this year.

Mike Hembree is NASCAR Editor for SPEED.com and has been covering motorsports for 30 years. He is a six-time winner of the National Motorsports Press Association Writer of the Year Award.