Ricky Stenhouse Jr. survived the late carnage at Talladega to win Sunday's Geico 500.

Stenhouse, who started on the pole, held off a push from Jamie McMurray and Kyle Busch to end a long winning drought for Roush Fenway Racing. 

Stenhouse passed Busch on the final lap of the green-white-checkered finish to get the first Roush victory in 101 races. It was the 24th time the winner at Talladega was decided by a last-lap pass. It was Stenhouse's first-ever win at Talladega in 158 starts. 

"This is for all the guys at the shop," Stenhouse told Fox Sports. "This year, every race we're getting better. We knew Talladega was a good track for us. I can't say enough about the guys."

Dale Earnhardt Jr., who started second, was near the front following a restart after a 18-car pileup until a loose left rear tire pushed him to the rear. He finished 22nd.

Ryan Blaney spun out on Lap 160 to bring the caution flag out for just the fifth time in the race. Blaney was forced to go to the garage, but did re-enter the race. He didn't finish, though, because he got caught in the big wreck that finally happened on Lap 168. 

Michael McDowell, AJ Allmendinger, Danica Patrick, Chase Elliott, Kevin Harvick and Austin Dillon were also among 18 cars involved in the pileup. It started when Allmendinger tapped Elliott to spin him around and force Elliott onto the wall. Allmendinger's car then got rolled onto its lid, but no drivers were injured.

"I was battling for the lead and (Harvick) was on me and, once I got to Chase, it was too late," Allmendinger told Fox Sports. "I hated that that happened, but it's Talladega.

"Racing happens here, if you want to call it that."

Brad Keselowski, who had four previous wins at Talladega, finished seventh after winning the first stage. Stage 2 winner Denny Hamlin was 11th. 

Monster Energy Cup points leader Kyle Larson was 12th. 

The race had 26 lead changes and eight cautions, four of which came in the final 30 laps of the 188-lap race. 

Full unofficial results from the GEICO 500: 

1. Ricky Stenhouse Jr. 
2. Jamie McMurray
3. Kyle Busch 
4. Aric Almirola
5. Kasey Kahne
6. Kurt Busch
7. Brad Keselowski
8. Jimmie Johnson
9. Paul Menard
10. David Ragan
11. Denny Hamlin
12. Kyle Larson
13. Ty Dillon
14. Clint Bowyer
15. Chris Buescher
16. Cole Whitt
17. Elliott Sadler
18. Matt DiBenedetto 
19. Daniel Suarez
20. Gray Gaulding
21. Joe Gase
22. Dale Earnhardt Jr.
23. Kevin Harvick
24. Matt Kenseth
25. Ryan Newman 
26. Brendan Gaughan 
27. Corey LaJoie
28. Jeffrey Earnhardt
29. Landon Cassill
30. Chase Elliott
31. AJ Allmendinger
32. Joey Logano
33. Erik Jones
34. Michael McDowell
35. Martin Truex Jr. 
36. Austin Dillon
37. Trevor Bayne
38. Danica Patrick
39. Ryan Blaney
40. Reed Sorenson

Stage 1 winner: Keselowski
Stage 2 winner: Hamlin