FORT WORTH, Texas — The timing was perfect for Kevin Harvick's first Monster Energy NASCAR Cup Series victory at Texas. So was his winning pass. Harvick went around the outside of Martin Truex for the lead with 10 laps to go, then stayed in front the rest of the way Sunday to win the Texas 500 and earn his championship shot in NASCAR's finale. "It's been a long time coming," said Harvick, who had won five Xfinity races and a truck series race there in the past. "Great to check that one off." Truex led 107 of 334 laps and was still up front until his bobble on the backstretch that allowed Harvick to take the lead. But Truex, with a significant points lead and wins in three of the eight playoff races, also locked into one of the four spots to race for the championship at Homestead in two weeks. "A little disappointed to come up short, but to clinch a spot in Miami is unbelievable," Truex said. "Definitely got the job done today, and came here and did what we needed to." Kyle Busch had already clinched a championship spot with his win at Martinsville a week ago to start the third round of the playoffs. That leaves only one spot up for grabs among the five remaining playoff contenders next Sunday at Phoenix in the Can-Am 500. After doing a long burnout along the frontstretch in the No. 4 Ford for Stewart-Haas Racing, Harvick went to Victory Lane, where the Texas celebration was missing the traditional firing of six-shooters by the winner. Texas Motor Speedway officials bypassed the use of the pistols after a man opened fire inside a church in a small community about 300 miles south of the track near San Antonio earlier Sunday. Authorities in South Texas said the shooter killed more than 20 people and wounded at least 10 others before being killed or killing himself. Denny Hamlin, another of the playoff contenders, finished third, while Brad Keselowski was fifth and Ryan Blaney sixth. Chase Elliott finished eighth, and his teammate Jimmie Johnson dealt with a loose car all day and finished 27th. Johnson got to Texas only three points out of the top four, and had won there for the seventh time last spring. But he made an early stop because of a vibration issue. "It was just a bad day that kept getting worse," he said after his second-worst finish in his 29 Texas races.Keselowski dropped from third to fourth in points, 57 behind Truex. Hamlin is fifth in the standings, followed by Ryan Blaney, Elliott and seven-time Cup champion Johnson. "I'd feel confident if we were locked in. These races you don't know what's gonna happen," Keselowski said.After several laps chasing down Truex, Harvick was eventually able to get around the No. 78 when he executed on a cue he had taken from watching Kyle Larson driving deep into turn one earlier in the race. "I knew I needed to do something different in order to get past Martin. I tried to just start driving it in there and we kept going faster and faster," Harvick said. "I kept driving it in there and one lap I got close enough to get the air off the back of his car. I actually got to the outside and was able to pass him on the outside." XFINITY: Erik Jones led 137 of 200 laps to win the O'Reilly Auto Parts 300 in Fort Worth, Texas, late Saturday, holding off Ryan Blaney. Elliott Sadler finished fourth to take the series points lead with one race remaining to set the final four in the run for the season championship at Homestead on Nov. 18.FORMULA ONE: Williams driver Felipe Massa, 36, will retire after the series finale at the Abu Dhabi Grand Prix on Nov. 26. Massa was going to retire last season but changed his mind after Valtteri Bottas left the team to join Mercedes. Massa has 11 wins in 268 races. Williams did not announce who will replace Massa next season to drive alongside Lance Stroll.