Common Mouth ulcers, or apthus ulcers are can happen due to lots of reasons, spicy food being one of them. Stress
at work, vitamin deficiency
or even very sharp teeth which end up cutting or scraping mucosa of the mouth and even tongue can lead to ulcers.
Any local anesthetic
ointment will make you feel better temporarily, but i would advice you to visit your dentist
to resolve the problem. Also try to reduce stress and avoid eating very spicy food.