At a total loss for an explanation

My car did the exact same thing and it was a faulty ECU.
It would start up just fine and in a few minutes it would just die. Had fuel and would spin but it would not even try and start. Let it sit for an hour and it would start right up.