The victims had just arrived at the station on a different train, said by witnesses to be very full, and decided to walk across the tracks to avoid using a busy underpass.
One youth who managed to cross the track told SER Radio: "At that moment a train came from the other direction and ran everyone over."
Day of mourning
All of those injured are under the age of 28 except on woman who is 45-years-old, local media reported.
About 30 people crossing were said to be heading for festivities on a nearby beach on the Mediterranean coast.
"It is a day of sadness and mourning on a night that should be of festivity, of a street party," Jose Montilla, the president of the regional government of Catalonia, said after visiting the scene of the accident.
A day of mourning has been declared in the Catalan region.
Marcelo Cardona, a 34-year-old Bolivian, said, "The euphoria of getting off the train immediately became screams. There were people screaming, 'my daughter! my sister!'"
Cardona said he saw "mutilated people, blood everywhere, blood on the platform".
An investigation into the causes of the accident is to be held, Jose Blanco, the transport minister, said.
Renfe, the state-owned rail network, said in a statement that the train which struck the victims was travelling below the recommended speed when it passed through the station and had made warning sounds beforehand.
It is the worst rail tragedy in Spain since 2003 when 19 people died in a collision between two trains in the town of Chinchilla.