My 1990 nissan 240sx idles at like 2000 and then suddenly dies...then I try to fire it up again and nothing...

The problem started when I was normally driving on the freeway then it suddenly lost the power and wont rev up, then it slowly died, it fire up back in like 5 minutes then I drove home and know I have the problem that I just told you. Any tips?