Once the Check Engine light has turned on there will be a diagnostic fault code stored in the Engine Computer. Most auto parts stores will read those codes for you for free. They will get you to the circuit or system with the problem, not necessarily the defective part.
It's important to not disconnect the battery or let it run dead because that will erase the codes and that valuable information will be lost. Have the codes read as soon as possible. If the intermittent problem does not act up within 50 engine starts, the code will erase by itself.