Jeff Gordon avoided a controversial late wreck and won the NASCAR Sprint Cup Series Goody's Headache Relief Shots 500 at Martinsville Speedway in Tennessee on Sunday. With the victory, Gordon earned an automatic berth in NASCAR's championship race at Homestead-Miami Speedway on November 22.

A four-time NASCAR champion, Gordon won for the first time in the 2015 season; it was his first checkered flag in 39 races. Jamie McMurray finished second, with Denny Hamlin in third, Dale Earnhardt Jr. in fourth and Kyle Busch in fifth.

Gordon’s victory came after Matt Kenseth intentionally wrecked leader Joey Logano with 47 laps left. The crash was seemingly revenge for Logano spinning the now-eliminated-from-the-Chase Kenseth at Kansas two weeks ago.

Logano led 207 of the 500 laps on Sunday, but he now finds himself last in the eight-driver field heading into the final three races.

The Chase continues next Sunday at Texas Motor Speedway.