Scientists say they now have more insight into an area "not well understood" after the research was conducted on a human for the first time.
In the study, published in Frontiers in Aging Neuroscience, an 87-year-old man with epilepsy was connected to an electroencephalogram (EEG) as he died.
For a 15-minute period, activity in the man's brain was recorded on the EEG, which detected a surge in gamma-band activity 30 seconds either side of him passing away.
This activity is also seen in acts such as meditation, memory and dreaming. The findings suggest that people's lives really could 'flash before their eyes', something which has been suggested by people who have experienced near death experiences.
“The human brain may possess the capability to generate coordinated activity during the near-death period," the report explains.
Dr Ajmal Zemmar, a neurosurgeon at the University of Louisville, who organised the study, said: "Through generating oscillations involved in memory retrieval, the brain may be playing a last recall of important life events just before we die, similar to the ones reported in near-death experiences.
"These findings challenge our understanding of when exactly life ends and generate important subsequent questions, such as those related to the timing of organ donation."
Dr Zemmar has said further research would need to be done, and explained that the same result may not appear in a different person.
He added: "Something we may learn from this research is: although our loved ones have their eyes closed and are ready to leave us to rest, their brains may be replaying some of the nicest moments they experienced in their lives."