Depending on the severity of the situation, you may want to unmount. Talk quietly to him, pat him gently, and make sure you stay calm. Horses can sense fear & nervousness in humans.
Calm yourself. Horses take cues from others nearby. If he senses you're agitated it will wind him up. Remain unstartled, speak reassuringly, look confident, and he'll follow suit.
Talk to your horse softly and pet his neck and keep rubbing him to let him know that he is ok and nothing is going to hurt him. That you are there to protect him.