What's up with my Miata?

My 2002 Mazda Miata LS has been a great car for the past seven years I’ve owned it; however, it has recently started acting up. While driving, it will begin to sputter almost like it’s running out of gas. When I’ve pulled off to the side of the road, it completely loses power, stalls, and the check engine light goes on. If I wait a few minutes, I can start it right back up again and continue driving without any problem, and the check engine light will turn off either immediately or the next day (this has happened three times in the last six weeks). I assume it has something to do with the eletrical system, but I wonder why it can function normally for weeks in between episodes and how it recovers so quickly and seemingly thoroughly after the few episodes I’ve experienced? Everything else about the car works perfectly, so I would love to figure this out and get an idea of what it will cost me to get if fixed.

Even though the CEL goes off, there will still be codes stored in the computer that can be read. Have your local auto-parts store read them (free) and post the codes back here.

All anybody can do now is guess, so my guess is a failing ignition module, fuel pump or fuel filter…It can be something as simple as a bad connection…