The No.6 Penske Racing Honda crossed the finish line 0.0635 seconds ahead of Andretti.
It was Hornish's first victory of the season, his first at Indianapolis and 15th of his IndyCar career. It is owner Roger Penske's 14th Indy 500 win.
"Its been a long month and not everything went our way as we saw today, but we stuck together as a team, we had a good plan and we were fast when we needed it," said Hornish.
Exploding whale video goes viral on Internet
Wisconsin business offering 'therapeutic cuddling' forced to close