Sounds like you lost spark in the motor and the cylinders got a lot of extra fuel. Then the spark came back and ignited the fuel in the exhaust system and that was the result.
It could be either the ignition switch or the ignition module.
Repair Safety Notice: This information is for general instructional purposes only. Vehicle repair can be dangerous. Verify all information, follow manufacturer service procedures, use proper tools and safety equipment, and consult a qualified repair shop when needed.