MARTINSVILLE, Va. — Jimmie Johnson dominated Martinsville Speedway again.

Johnson led a career-best 346 laps Sunday and pulled away on a restart with eight laps left to score his eighth career victory at Martinsville Speedway.

“It was just a long, hard-fought day,” Johnson said after climbing from his car in Victory Lane. “Martinsville, it stays the same over the years, and you just have to dig in and get your own rhythm. Fortunately, the fastest car won the race.”

The victory moved Johnson into third place in career victories on the shortest track in the Sprint Cup Series. He’s trailing only Richard Petty, who won here 15 times, and Darrell Waltrip (11).

It also made team owner Rich Hendrick’s organization the winningest team in Martinsville history with 20 victories, breaking a tie it had with the Petty organization.

“I think the last stop or two, we really got our car adjusted right,” Johnson said.

The five-time series champion picked the inside line for the final restart with Clint Bowyer on the outside, teammate Jeff Gordon behind him and Kyle Busch to his outside. Johnson got a clean break for the lead into Turn 1.

Bowyer slid into second, and Busch, who tried to make a move on the outside, instead got hung up as Gordon and his Hendrick Motorsports teammate, Kasey Kahne, who was fifth, went underneath to take fourth. Nothing changed the rest of the way.

Gordon, who was tied with Johnson and Rusty Wallace with seven victories on the 0.526-mile oval, said he knew it would be a tough day when Johnson won the pole for the second race in a row here because of the pit road advantage.

“You give him that No. 1 pit stall here at Martinsville, it’s almost impossible,” Gordon said.

Johnson didn’t dominate throughout. Matt Kenseth, who has struggled at Martinsville, actually passed him for the lead and led for 96 laps.

Mark Martin, driving for the injured Denny Hamlin and equally disdainful of the trickiest track in the series, moved into fourth after getting just two tires on a pit stop, then faded.

Danica Patrick, whose boss, Tony Stewart, said earlier in the week he thought it would be funny to watch her try to navigate around the track, got passed by his rookie driver with 19 laps to go. Patrick finished 12th, Stewart 17th.

IndyCar

HUNTER-REAY PREVAILS: In Birmingham, Ala., Andretti Autosport remained perfect on the year when defending IndyCar Series champion Ryan Hunter-Reay snapped Penske Racing’s winning streak at Barber Motorsports Park.

Hunter-Reay proved to be a credible threat for the victory when he beat both Will Power and Helio Castroneves for the pole. The Penske drivers had swept every pole and all three races in IndyCar’s previous visits to the Alabama road course.

Hunter-Reay then ran a steady race — and held strong in one intense battle for position with both Penske drivers — to claim his first win of the season. Then he had to hold off Scott Dixon, who finished second for the fourth straight year.

“I was dragging my tail off trying to hold off Dixon,” Hunter-Reay said.

Castroneves was third to take over the IndyCar points lead, and Charlie Kimball, Dixon’s teammate at Chip Ganassi Racing, was a career-best fourth. Power finishhed fifth.

RACE TO REMAIN: IndyCar will race at Barber Motorsports Park at least through 2016 under a contract extension announced Sunday.

The three-year extension between IndyCar and ZOOM Motorsports ensures the open-wheel series at least one stop per year in the South.