Of course, this would differ from spice to spice. The archetypical "hot" spice is the active ingredient in hot chili peppers: Capsaicin.
A really quick search on Google Scholar brought up this link:
Study on Antibacterial Activity of Capsaicin WEI Yu-xi, SHUAI Li, GUO Dao-sen, LI Shan, WANG Fu-li, AI Gui-hua, published in the Chinese journal "Food Science" in 2006.
Capsaicin from Capsicum annuum is one of the principle substances which have many important biological activities in food and medicine. In this paper its antibacterial activity was studied through the method of stiletto on capsaicin crystal. The results showed that capsaicin has strong antibacterial activity to bacteria supplied, but weak to mold. Furthermore, its concentration affects the antibacterial activity, and no inhibition effect is found when the concentration of capsaicin is less than 0.0125mg/ml. It indicated that capsaicin can be a good antibacterial agent as well as a pungent agent.
Killing bacteria is an important aspect in preserving foods, so indeed, if the spice contains capsaicin, it has antibacterial traits.