MARTINSVILLE, Va. -- Denny Hamlin just needed a visit to Martinsville Speedway to get his racing team back on track. Now, with his spot in NASCAR's Chase for the championship virtually assured, they can work to make it better.

Hamlin passed teammate Matt Kenseth for the lead with 28 laps left and ended Toyota's 32-race winless streak in the NASCAR Sprint Cup race at Martinsville Speedway. It was his fifth victory on NASCAR's oldest, smallest circuit.

"We had a very fast car, but obviously some pit road issues, but we overcame it," Hamlin said after his 25th career victory, which was helped along by a blunder that took four-time champion Jeff Gordon out of contention late.

Hamlin held off a five-lap, bumper-to-tail challenge from Brad Keselowski at the finish. There was some bumping and nudging, and a big wiggle for Hamlin in the final fourth turn, but Keselowski never caused him to spin.

"We just weren't going to be denied today, and hats off to Brad," he said, thanking Keselowski for not wrecking him.

advertisement | advertise on newsday

"I did everything I could other than wreck him," Keselowski said.

Keselowski was second, followed by Joey Logano, Kenseth and David Ragan, giving Joe Gibbs Racing three cars in the top five. The jolt was especially appreciated in a week when the team announced that president J.D. Gibbs, Joe's son, is being treated for a "symptoms impacting areas of brain function," an issue that has baffled doctors.

It was J.D. Gibbs who discovered Hamlin on a North Carolina short track, and Joe Gibbs thought of that near the end.

"For me it was emotional and thinking about J.D. and all that he means to our team, so it was a big week for us, but a great finish to a story there," Gibbs said.