INDIANAPOLIS — First, Brad Keselowski figured out the secret to restarting at the Brickyard 400.

Then he safely and strategically bumped his way into the lead and sped to the finish line.

One year after settling for second in a chaotic, crash-marred race, Keselowski redeemed himself Monday by earning his second straight major win and finally giving team owner Roger Penske the elusive Brickyard win.

The 2010 Cup champion got past race leader Denny Hamlin on the second-to-last lap and beat Erik Jones to the finish line by 0.904 seconds. Hamlin finished third.

“Last year, I lost this race almost the exact same way. To bring it home this way, after messing up last year, is just incredible,” Keselowski said. “We were hoping this would be No. 500 at the Brickyard, but that’s all right.”

Penske certainly won’t be complaining about getting win No. 499 on the same historic 2.5-mile oval where he has won a record 17 Indianapolis 500 crowns.

His first win in 25 Cup tries at his favorite racing venue came in a rain-delayed race on one of the rare days he wasn’t actually attending in the pits.

But Penske now joins Chip Ganassi as the only owners to win the Indy double in a season. Will Power captured his first 500 win in May. Dario Franchitti and Jamie McMurray both won at the Brickyard in 2010 for Ganassi.

The timing couldn’t be better for Keselowski. He heads into the first round of the playoffs with momentum following wins at the Southern 500 and the Brickyard.

And he earned this one the hard way.

He stayed close off the final restart with three laps to go, then quickly chased down Hamlin, running side by side with the race leader briefly on lap 159. At one point, the cars touched but both drivers maintained control and Keselowski made the decisive move in the front straightaway just as the white flag started to come out.

Nobody got close again.

“Not having guys in the back wreck,” Hamlin said when asked what could have gone differently, referring to the late crash involving Landon Cassill and Jeffrey Earnhardt. “That allowed all the guys who take tires to come back up there at the end. It happens sometimes.”

Hamlin’s consolation prize will be joining Keselowski and Jones in the first round of the playoffs next week.

Seven-time Cup champion Jimmie Johnson and Alex Bowman captured the final two open playoff spots in the 10-race sprint to the championship.

Fourteen drivers went into the race knowing they would compete for this year’s title and now they know how they stack up.

Kurt Busch clinched the regular-season title with an eighth-place finish in the No. 18 Toyota for Joe Gibbs Racing. His teammates, Jones and Hamlin, are seeded 10th and 13th.

Keselowski, fourth, will be joined by Penske teammates Joey Logano, sixth, and Ryan Blaney, ninth. Stewart-Haas Racing drivers claimed four postseason spots – Kevin Harvick (second), Clint Bowyer (fifth), Kurt Busch (seventh) and Aric Almirola (14th).

Martin Truex Jr., of Furniture Row Racing, is seeded third even though he exited late in the first stage Monday.

XFINITY SERIES: Justin Allgaier still remembers his father making the 3½-hour drive from Illinois to Indianapolis every Wednesday for driving classes.

So maybe a rain-delayed celebration was the perfect tribute for his first career victory at the Brickyard.

Allgaier led each of the final 10 laps on Monday and held off a last-lap challenge from teammate Tyler Reddick to claim his fifth victory of the season. Allgaier won by 0.092 seconds. Ryan Blaney was third.

“Never in a million years when I was sitting in the grandstands did I think I could win here,” Allgaier said. “I used to come here all the time. I used to sit in the grandstands down here in turn one, which is why I wanted to go down there after I won. My dad brought me over here to take classes so I could be the best I could be.”

Lately, nobody has been better than the 32-year-old driver of the No. 7 Chevrolet.

After sharing the traditional kiss of the bricks with his wife and daughter, Allgaier goes into the regular-season finale assured of a playoff spot and holding a 16-point lead over Elliott Sadler. Sadler’s day ended when he got caught in a six-car crash on lap 23 of the 250-mile race.

Waiting an additional 48 hours, after heavy rain wiped out the entire weekend schedule, didn’t bother Allgaier, either. The only real challenge he faced over the final stage came from Reddick, his teammate with JR Motorsports, the team owned by retired NASCAR driver Dale Earnhardt Jr.

He tried to pull side by side with Allgaier. But Reddick didn’t have enough momentum to make the pass, then smartly backed out and settled for second.