96 sentra revs high then dies while driving

I have a 96 nissan sentra with 283xxx miles on it. It’s been great. But today while my daughter was driving it revved very high then died. She coasted to the shoulder but couldn’t restart it right away; but about 5 minutes later she was able to start it and drive away. I drove this afternoon with no problems, though a couple of times the engine ran rough. Any ideas as to what is causing this?

Automatic or manual transmission?

Did the car accelerate when the engine revved high? Do you know how high it revved?

It’s an automatic. The car did not accelerate when it revved, and it didn’t rev too high according to my daughter.