After passing Hamlin, Edwards conserved enough fuel to hang on and post his first Sprint Cup victory since the 2008 season-ending race at Homestead, Fla.
The victory made it a double-threat weekend for Edwards, who also won the Nationwide Series race at Phoenix Saturday.
Hamlin ended up finishing 12th, and as a result his championship points lead over Jimmie Johnson shrank from 33 to 15. Johnson hoarded enough gas to finish fifth Sunday.
Kevin Harvick came in sixth and finished the day 46 points behind Hamlin.
The tight grouping at the top of the standings has made for a very close Chase championship competition heading into next week's season-ending race at Homestead.
Ryan Newman claimed second place at Phoenix, Joey Logano took the third spot and Greg Biffle ended fourth.