Same thing has happened to me.
4 times i've had the check engine light come on.
1st time - #4 cylinder spark plug gap was completely closed causing misfiring (mazda said a piece of carbon deposit hit the plug)
2nd time - #4 cylinder spark plug gap was comletely closed causing misfiring...