A non-reflexive, involuntary contraction of the anal sphincter muscles that may be associated with pain and/or functional interference. A spasm can result from many etiologies and differs from a reflex.