Cayenne pepper is the hottest pepper that we normally consume. Chili is milder but still hot. Now there are firey peppers known as habanero and jalapeno peppers that will really make one sweat. These peppers contain Capsaicin which is where the fruit of the pepper plant gets its heat.
The heat from peppers is measured in BTUs. Cayenne peppers can measure up to 40,000 to 60,000 BTUs. The higher the number the hotter the pepper.
The body reacts to the heat of ceyenne pepper just like heat from a warm room. In fact pure cayenne oil can raise blisters on skin. It is a chemical reaction rather than a physical reaction. Cayenne is used medicinally to treat poor circulation as the action of making you sweat is really moving blood to the surface of the skin. The body is attempting to "cool down" by pushing blood to the surface of the skin. The body's cooling process is evaporative cooling.
Cayenne and other spicy foods are typically consumed in tropical climates because of their "cooling" action. Making you feel warmer than you are, and then causing a sweat will in reality cool you down in a hot climate.
Cayenne actually can raise the body temperature a bit, as it stimulates circulation and blood flow to the skin. An herb such as cayenne or ginger that promotes fever and sweating is considered to have a diaphoretic (sweat-inducing) action. This action can help reduce fevers and relieve such the congestion of colds and sinusitis.(http://health.howstuffworks.com/cayenne-pepper-herbal-remedies.htm)
Other foods that cause this same sensation but to a lesser degree are black pepper, ginger, yarrow (bitter herb), and horseradish.
When you say 'spicy' food I think you mean food with Chilli Peppers in it. (Other spices don't produce a sweat reaction.)
The substance that gives chili peppers their intensity when ingested or applied topically is called capsaicin, (capsaicin is the primary ingredient in pepper spray.)
When consumed, capsaicins bind with pain receptors in the mouth and throat that are normally responsible for sensing heat. Once activated by the capsaicinoids, these receptors send a message to the brain that the person has consumed something hot. The brain then responds to the burning sensation by raising the heart rate, increasing perspiration and release of endorphins.
So basically the capsacins in chilli peppers confuse the body's system for monitoring heat and the body reacts as though it was very hot, and sweats.