What a weekend it was for Brad Keselowski at Kentucky Speedway.

Keselowski went from crashing his primary vehicle on the opening lap of Friday's first practice session to winning Saturday night's Sprint Cup Series race in a backup car at Kentucky. The Penske Racing driver hit the wall when he made contact with Juan Pablo Montoya.

The 28-year Keselowski gambled on fuel in the late stages of the Quaker State 400. He passed Denny Hamlin and grabbed the lead one lap before he made his final pit stop with 55 laps remaining.

With enough fuel to get him across the finish line, Keselowski beat Kasey Kahne by 4.4 seconds for his third win in 2012 -- the most in the series so far this season. It was also his seventh career Sprint Cup victory.

"We hit the wall on lap one in practice and brought out the backup car," Keselowski said. "This is my Martinsville car from the Chase last year. This ain't the newest car we got, but it sure runs. We had a fast race car and fought back from adversity all weekend long.

"In 100-degree temperatures, we got this car out and got it ready on the racetrack to practice, and that hard work, that was the weekend for us. That's what got us here to victory lane."

Keselowski placed second in the second and final practice session.

With three wins, Keselowski put himself in great shape to qualify for his second straight Chase for the Sprint Cup championship. Last year, he earned a wild card spot in the Chase with three victories during the regular season. He finished the year fifth in points.

Keselowski's two other victories this season came in March at Bristol and May at Talladega.

Despite the win at Kentucky, Keselowski remained 10th in the rankings. Nine races remain before the Chase begins on September 16 at Chicagoland. After the Sept. 8 event at Richmond, the top-10 in points will qualify for the 12-driver playoff field. Positions 11 and 12 -- the wild cards -- go to the non-top-10 ranked drivers with the most wins, as long as they're ranked in the top-20 in points.

Keselowski feels very confident his win total so far will earn him a spot in the Chase.

"Yeah, three wins feels pretty dang good," he said. "We want to climb up the (points) ladder and not have to worry about the wild card, but I'm glad to have the wins to fall back on."

Kahne battled back from an mishap on pit road early in the race. He had to pit again for a loose wheel, which put him one lap behind.

"We had to pass a ton of cars but came up a little short," Kahne said of his second-lace run. "My pit crew is really, really good. We just had a couple of mistakes on two different stops, and we couldn't get enough track position and had to fight for a long time."

Hamlin wound up finishing third.

"I had such good speed at the beginning of the (last) run, but I had to back it off to save fuel," he said. "Had I known how much fuel I had left, maybe I would have run with (Keselowski). I just couldn't risk it. One spot isn't worth not finishing."

Prior to the start of the 400-mile race, Hamlin revealed that he had signed a contract extension with Joe Gibbs Racing.

While Kahne placed second, his Hendrick Motorsports teammates, Dale Earnhardt Jr., Jeff Gordon and Jimmie Johnson, finished fourth through sixth, respectively.

Matt Kenseth, who announced earlier this week that he is leaving Roush Fenway Racing at season's end, took the seventh position. Martin Truex Jr., A.J. Allmendinger and Kyle Busch completed the top-10.

Busch led a race-high 118 laps but scraped the wall just past the halfway point and dealt with an ill-handling car from there. He won last year's inaugural Sprint Cup race at this 1.5-mile racetrack.

Defending series champion Tony Stewart experienced engine problems in the early stages and had to spend time behind the wall for repairs. Stewart finished 34 laps behind in 32nd.

Kenseth's lead in the point standings is now over 11 over Earnhardt Jr. Johnson is third in the rankings (-23), while Biffle dropped to fourth (-25) following his 21st-place run.

Keselowski is currently 34 points ahead of 11th-place Carl Edwards, who finished 20th after he was forced to pit for fuel in the closing laps.