Pepper spray (the civilian version of the chemical mace used by law enforcement personnel) is a less-than-lethal defensive weapon that comes in a pressurized container. All you have to do is point the canister at an assailant's eyes and let the spray do the work. As with any weapon though, traveling abroad with pepper spray might be problematic.
If you are going to bring pepper spray on a flight, you cannot have it on you or in your carry-on bag. Pepper spray will have to be left in cargo luggage. Once you arrive in Mexico, your luggage may be searched, but the civilian pepper spray will not cause any alarm. The same rules for flying back to the States with pepper spray apply, so make sure you do not accidentally leave the spray in your pocket.
Pepper spray is completely legal to purchase in Mexico, and it can be found at large businesses and even in pharmacies. There is a saying (and even the tone of the U.S. government advice implies) that anything can be purchased in Mexico for the right price. However, if a good is sold openly at a reputable business (rather than off of a cart or a lean-to-stall), then you can usually assume that it is a legitimate item.
Pepper spray is meant to be used as a defensive weapon. It is a less-than-lethal weapon, but it is a weapon nonetheless. If you intend to use it, make sure the situation is serious enough. If you are threatened in some way, you must also be in a sober state of mind and be able to judge the situation properly for your story to carry weight with the authorities. If you use pepper spray in any other situation, you will have to answer to criminal assault charges.