Please work on refraining from hitting your son at all. Spanking or any other physically hurtful actions on your part will only deepen his sadness, confusion, and anger, while showing him that physical aggression is indeed a way to deal with his anger and frustration.
I would strongly recommend seeking the help of an experienced therapist who has seen children who have experienced parental abandonment at an early age. In addition to some compassionate counseling for both of you, I would suggest that you and his teachers brainstorm ways to bolster his sense of self-worth. Use encouraging words and role-play to show him how he can handle social situations without resorting to hitting. Learn to spot his "red flags" and redirect his attention before he "breaks out" in anger and physical aggression.