Hamlin traveled around the half-mile track at 99.595 mph to win the 17th pole of his career and a series-best fifth this season. Four of those poles have been won at Martinsville, although he missed the spring race at the track while recovering from a compression fracture in his lower back.
Jimmie Johnson, who took the lead in the championship race last week at Talladega, will start on the outside of the first row after turning in a lap at 93.344 mph. He has won the last two races held in Martinsville.
The top 18 qualifiers broke the old track record of 98.400 set by Johnson in April.
Notable deaths of 2014 [PHOTOS]
LeBron James reveals his new Nike shoes