Rabbi Yohanan ben Zakkai told his students: “May it be His will that the fear of Heaven shall be upon you like the fear of a mortal…. Know that when a person commits a transgression, he says to himself, ‘I hope that no man will see me..(Berakhot 28b).
When the students of Rabbi Yohanan ben Zakkai asked him, “Only as far as that?” he answered, “If a person would only reach that level of fear, that would be enough.”
After all, by virtue of having this fear, a person refrains from transgressing.
The “fear of a mortal” that Rabbi Yohanan ben Zakkai wished upon his disciples is not the fear of being killed or treated badly, but rather it refers to the shame a person feels when he does something that is considered indecent by society.
It is the fear of disgrace and discomfort, whether in the eyes of a person or of God.
Since this fear makes a person avoid evil just like a fear of tangible harm does, it too is considered fear.
Rabbi Adin Steinsaltz