Thinking that the individual's need are surpassed by the needs of the many is not a logical, but a political thought, and an idealist one for that matter. That was one of the main ideas of communism as well.
it's utilitarianism.
No, it is not, you misunderstand utilitiarinism then. In addition, utilitarianism weighs the moral worth of an action by its outcome. In utilitarian terms, Spock's action was useless.
No, Sonak has it right.
A utilitarian action can fail, but still have a utilitarian motivation all the same. Spock's reasoning was to do the greatest good for the greatest number. He was acting on that basis when he sacrificed himself. Whether or not he succeeded is moot, it was still an act which was informed by a utilitarian calculus.
Moreover, utilitarianism is bigger than politics - it is not merely "a political thought." It is an ethical perspective which informs many moral philosophy. The instrumentalism upon which utilitarianism is based informs a countless array of human decisions.
You are, however, correct in pushing back against Spock's assertion that "logic clearly dictates" that his vague utilitarian premise is correct (it is vague in that he does not identify what "needs" are, so he does not explicitly commit himself to the hedonic aspect of the utilitarian formula - if we were to quibble about his utilitarian credentials we should do so here). If, however, you accept the premises of utilitarianism, then you would indeed find that reasoning from those premises that your logic would dictate certain actions.
HERE'S THE FUNNY PART
Spock was B.S.-ing. He wasn't even really being a utilitarian in that moment.
Spock knew that Kirk emotionally needed to be in command of the Enterprise. There was no real pressing need for Kirk to assume command at that moment. There was something irregular at Regula 1, but that's all they knew. After the training simulation Spock saw that Kirk was depressed when he announced that he was going to the Enterprise when Kirk had no other destination but home. His other friends could see it too -- McCoy knew Kirk was in a funk when he told him to get back his command.
Spock was being a friend. He was standing aside because Kirk was very much like Sherlock Holmes needing his mysteries. Kirk needed command, so Spock made it easy for him.
The unequal need of the one, his friend, outweighed everything else at that moment.
I suppose we could quibble and argue that he was still being a utilitarian in that moment and recognizing Kirk's middle aged needs as turning him into a bit of a "utility monster," but it's pretty clear I think, that he was simply deferring to the subjective needs of a friend rather than the objective needs of everyone equally.