The girl's other family members were killed in the incident, local authorities confirmed.
After last weekend's high-speed train derailment and collision in Spain claimed at least 40 lives, a 6-year-old girl emerged from the disaster mostly unscathed while the rest of her family perished.
A relative of the unidentified girl told Spanish newspaper La Vanguardia that the child was generally unharmed and suffered a few scratches on her head.
The child, who is from Punta Umbría, a town in the province of Huelva, escaped from the front carriages of the Renfe Alvia 2384 train after it collided with an Iryo train following a derailment in southern Spain on Sunday, Jan. 18, the outlet reported.
Walking alone, the girl was found by two Civil Guard officers in the vicinity of the derailment, La Vanguardia reported. The child was taken into the custody of the Civil Guard until she was reunited with her grandparents.
The newspaper further reported that the girl's relatives were searching for her and the family for several hours until they received the tragic news on Monday, Jan. 19, that the girl's father, mother, brother and cousin had died in the crash. The four deaths were confirmed by the Punta Umbría Town Hall.
"My son called me to tell me that my cousin was on the Alvia train and that he was supposed to get to Huelva," a cousin of the child's father told La Vanguardia.
José Carlos Hernández, the mayor of Punta Umbría, led a moment of silence for the victims, The Associated Press reported.
"There are many people who are very sad for the victims of this terrible accident," Hernández told the media on Tuesday, Jan. 20, "but there were also many who survived, like the miracle of the girl who is safe."
The girl and her family had spent the weekend in Madrid watching soccer team Real Madrid play Levante, La Vanguardia reported.
Hernandez said that the girl is with her grandparents in a hotel in the city of Cordoba, which is near the site of the derailment.
"She has a tremendous family who will do what it takes for her to have a happy life," Hernandez said, AP reported.
On Sunday, at 7:45 p.m. local time, the Iryo train heading to Madrid from Málaga was approaching the Adamuz train station when its last two cars derailed, according to a preliminary report from the transportation ministry.
The derailed cars then swerved into the path of the Renfe Alvia train traveling in the opposite direction. The impact caused the two front cars of the Alvia train to fall down a 13-foot embankment.
At the time of the collision, the Iryo carried 289 passengers and the Alvia contained 184 people, according to AP.
There have been at least 40 deaths reported so far from the tragedy, according to AP, La Vanguardia, and The New York Times.
Spanish Prime Minister Pedro Sanchez has declared three days of national mourning in the wake of the disaster and visited the crash site on Monday, according to the BBC.
"This is a day of sorrow for all of Spain, for our entire country," Sanchez said.
"We are going to get to the truth; we are going to find the answer," he added, "and when that answer about the origin and cause of this tragedy is known, as it could not be otherwise, with absolute transparency and absolute clarity, we will make it public."