Hi A.,
First, you're right, spanking does not teach a child not to hit, it sends a mixed message.
When your child hits another child, be firm that it is not okay! No if ands or but, it's not okay. He needs to be taken from the situation and allowed to calm down, I don't believe in the typical time-out, I find in the long run those do not work as well.
After you child has calmed down, it's time for you to talk. Talk about why hitting is wrong, talk about other ways of dealing with his disappointment and confusion about his Dad's departure. Talk about why Dad left and when he'll come back. Lastly talk about other ways showing his anger.
Boys have a harder time talking out their feelings than girls do, so teaching him these skills now is important.
Good Luck
R. Magby