There are a number of things that will turn that light on, its a catch all.
1) you drove off with the gas cap missing. It is mandatory for cars to have this feature that detects the gas cap missing and they flash the engine light. You need to cap the gas and start the car a few times for the light to go off.
2) There are sensors in the engine block that detect knocking and try to adjust the idle speed, if you change gas types (normal, high octane) you can sometimes get this light.
3) your car is overheating, check to make sure you're not overheating and that you have plenty of coolant.
4) go online and find the procedure to read your engine computer. Most cars (like your mazda) have a feature that will display what is the last code that caused a problem on your car, you basically turn on the car while pressing something and do a combination of things and the code will flash on your odometer display in a sequence of usually two to three blinks, you count the blinks and read from a list what happened. Or, go to a mechanic with the scanner that will read out all the codes your engine put out since it was last reset.
The most important thing to remember is that when the engine light comes on you have to get it looked at, if you don't you run the risk of ruining the engine, unless its the gas cap thing, you should really get it checked. Your mazda dealer should be able to read the codes and tell you what they say.