Earnhardt avoided a crash involving former Daytona 500 winner Trevor Bayne with 17 laps to go and passed Carl Edwards to grab the lead for good, then held on during a two-lap sprint to the finish following another multicar mishap.
He edged Hamlin by 0.092 seconds, adding the victory to his first Daytona win in 2004 and ending a 55-race drought stretching back to 2012.
Earnhardt finished second in each of the two previous Daytona 500s.
The season-opening event was delayed for nearly 6 1/2 hours after 38 laps had been completed -- the longest rain delay in Daytona 500 history.
It was halted after the National Weather Service had issued a severe thunderstorm warning and a tornado warning for northern Florida during the late afternoon.
Celebrity Breakups and divorces of 2014 [PHOTOS]