Lewis Hamilton blamed himself for a "terrible" Spanish Grand Prix after he finished sixth in Sunday's race.