Earnhardt Jr., NASCAR's most popular driver, passed Carl Edwards and took the lead for good just before a caution for an accident involving former Daytona 500 winner Trevor Bayne with 17 laps to go.
A multi-car crash in the closing laps set up a two-lap sprint to the finish. Earnhardt pulled ahead of the field after the final restart and then beat Hamlin to the finish line by 0.092 seconds. Hamlin had won the preseason event at Daytona International Speedway last weekend and the Daytona 500 qualifying race this past Thursday.
Earnhardt Jr. won the Daytona 500 for the first time in 2004. He also ended a 55-race winless streak in the Sprint Cup Series. His last victory came in June 2012 at Michigan.
"I can't believe this," Earnhardt Jr. said over his team radio after taking the checkered flag. "This is better than the first one."
Earnhardt Jr. had finished second in the last two Daytona 500s, including a runner-up to Hendrick Motorsports teammate Jimmie Johnson one year ago.
Jeff Gordon, a three-time Daytona 500 winner and Earnhardt Jr.'s, teammate at Hendrick, finished third, followed by Brad Keselowski and Johnson, who had to start from the rear of the field in a backup car. Johnson, the six-time and defending Sprint Cup champion, wrecked his primary car during the final lap of the qualifying race. He also crashed in the preseason event.
Ricky Stenhouse Jr., Matt Kenseth, Austin Dillon, the pole sitter, Greg Biffle and Casey Mears finished sixth through 10th, respectively.
Copyright 2016 Nexstar Broadcasting, Inc. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.