Concord, NC (SportsNetwork.com) - Denny Hamlin held off Kevin Harvick during the final 10-lap segment to win Saturday night's NASCAR Sprint All-Star Race at Charlotte Motor Speedway.

Hamlin, who started on the pole, took over the lead for the start of the last segment when he exited off of pit road in first during the mandatory pit stop. The driver of the No. 11 Joe Gibbs Toyota entered pit road in sixth after the fourth 25-lap segment had concluded, but his crew was able to get him back on track the quickest.

"Just a big day," said Hamlin, who collected $1,045,009 for his all-star win. "It's an unbelievable experience. We just didn't have a car that was fast enough to run with those guys until (crew chief) Dave (Rogers) made that last adjustment, and my pit crew carried me all day long. They got us this victory."

It was the first time Hamlin won the all-star race in his ninth start. He also gave Joe Gibbs Racing and Toyota its maiden victory in this non-points event.

Harvick, the defending Sprint Cup Series champion and current points leader, finished 0.923 seconds behind Hamlin. He started from the rear of the 20-car field.

In qualifying, held prior to the race, Harvick received a five-second penalty on his qualifying run for a pit-road violation, causing him to finish last.

"I kind of put us in a hole in qualifying," Harvick said. "Our (car) was really fast. We were able to get through traffic. They (No. 4 Stewart-Haas Racing team) made some really good changes throughout the night to get the car where it really needed to be. I was able to move around the racetrack and find a groove that worked for me."

Kurt Busch placed third, while Jeff Gordon, who made his 22nd and final appearance in the all-star race, took the fourth spot. Matt Kenseth was fifth.

Kyle Busch started 19th and finished sixth in his first race since he fractured his right leg and left foot in an accident in the Feb. 21 Xfinity Series event at Daytona International Speedway. Busch missed the first 11 Sprint Cup races this season.

"All in all, it was a good evening," Busch said. "We were clicking off some spots, moving ourselves forward. Felt really good about things. I got busted for speeding on pit road. In that same segment, we ended up having a loose wheel. At least it was two things biting us in one segment, not two things biting us in different segments. That was a real positive. But real fortunate just to get back in the race car."

Kasey Kahne was seventh, followed by Team Penske drivers Joey Logano and Brad Keselowski, who led the most laps with 49 and held the top spot at the end of the second and third segments. Keselowski came onto pit road first for the final round of stops. He had exited in second, right behind Hamlin, but was penalized for speeding off of pit road, which placed him to the tail end of the lead lap for the last restart.

"I knew when I came out of my pit stall and the 11 (Hamlin) was pulling out with me that I either beat him to that line or lose the race, and the penalty was I think three-tenths of a mile an hour over the speed limit, but I told my crew chief (Paul Wolfe) I'd rather go down swinging than take a strike and wonder what might have been. I swung and missed," Keselowski said.

Dale Earnhardt Jr. finished 10th.

Finishing 11th through 20th were: A.J. Allmendinger, Clint Bowyer, Greg Biffle, Aric Almirola, Jimmie Johnson, Jamie McMurray, who won this race last year, Carl Edwards, Ryan Newman, Tony Stewart and Danica Patrick, who was the only driver who did not finish on the lead lap. Patrick experienced engine trouble midway through the third segment and spent more than 30 laps in the garage for repairs before she returned.