Lewis Hamilton claimed his first race victory for Ferrari after a strategy gamble at the Barcelona-Catalunya Grand Prix as championship leader Kimi Antonelli dramatically retired late on.