Brad Keselowski snatched victory from Denny Hamlin in the final laps of the Brickyard 400 on Monday to give Roger Penske a sweep this year at Indianapolis Motor Speedway.

Will Power won the Indianapolis 500 in May for Team Penske’s 17th victory in that event. Despite all the organizational success at Indy, no Penske driver had been able to win NASCAR’s Brickyard 400.

Keselowski, an afterthought most of this season, used fresher tires and timely late cautions to put Penske in victory lane. Keselowski has now won two consecutive races headed into NASCAR’s playoffs. The victories are big ones, too: the Southern 500 last week and now the Brickyard 400, two of NASCAR’s crown jewel events.

Keselowski and his No. 2 crew climbed the Indianapolis fence to celebrate, a move made famous by Team Penske driver Helio Castroneves, a three-time Indianapolis 500 winner.

Keselowski wasn’t a factor until two late cautions gave the 2012 series champion a chance to use fresher tires to chase down Hamlin. The race went green with three laps to go and Clint Bowyer, in second, spun his tires. Keselowski darted around Bowyer into second, then caught Hamlin. The two cars touched a handful of times as they raced for the lead, and Keselowski finally surged ahead with a little more than one lap remaining.

He won by 0.904 seconds over Erik Jones. Hamlin was third 1.703 seconds behind. The victory was the first for Ford at Indianapolis since 1999.

Steady rain for three days in Indianapolis washed out all activity surrounding NASCAR’s regular-season finale and Monday was a doubleheader with the Xfinity Series, won by Justin Allgaier, followed by the Brickyard. At stake was a wild-card slot in the 16-driver playoff field, available only to a first-time winner this season.

Jamie McMurray gave it a late go and challenged Bowyer for position on a restart with 12 laps remaining. McMurray couldn’t get past Bowyer, and Keselowski used the opportunity to pick off another spot and put himself in position to make a run.

Hamlin was frustrated by an accident between Landon Cassill and Jeffery Earnhardt with seven laps remaining that gave Keselowski a shot at the win.

“Cautions killed us at the end,” Hamlin said.

Kyle Busch won the regular season championship and Jimmie Johnson and Alex Bowman claimed the final two open spots in the playoff field. The other drivers competing for the championship: Kevin Harvick, Martin Truex Jr., Kurt Busch, Joey Logano, Bowyer, Kyle Larson, Hamlin, Ryan Blaney, Chase Elliott, Jones, Austin Dillon, Aric Almirola and Keselowski.

The playoffs begin next Sunday at Las Vegas Motor Speedway.