The force of the crash at the Estacio de Franca in the north of the city crumpled the front of the carriage and tore off a sheet of metal.
Emergency services said 20 of the injured, including the driver, were taken to hospital, while paramedics treated the rest at the scene.
Many passengers were standing ready to get off the train at the time of the collision, according to the newspaper La Vanguardia.
The regional rail service had travelled from the southern coastal town of Sant Vicenc de Calders, some 44 miles from Barcelona.
It crashed on reaching its destination at 7.15am local time (6.15am UK time).
The state-run railway company ADIF said an investigation has been launched into the cause of the accident.
© 2017, Vale of Glamorgan Broadcasting CIC T/A: Bro Radio & Sky News.