One person was killed and 44 others were injured, three seriously, on Tuesday when a commuter train derailed near Barcelona due to a landslide caused by heavy rains, emergency services and Spain's rail operator said.

Two carriages of a convoy of six came off the tracks at 6:15 am (0515 GMT) near the town of Vacarisses, 35 kilometres (20 miles) northeast of Barcelona, emergency services said on Twitter.

Of the 131 people on board, 41 were lightly injured, three were seriously injured and one person died, it added.

Images broadcast on Spanish television showed rescue workers evacuating passengers. Rocks piled up on the side of one carriage.

The train, which was travelling between Manresa and Barcelona, derailed due to a landslide following several days of heavy rain in the region, train operator Adif said in a statement.

The area was fitted with netting to hold back rocks "but it did not resist the landslide," Transport Minister Jose Luis Abalos told news radio Cadena Ser. He said his ministry would investigate the cause of the accident.

Landslides had already caused trains to derail in the same area in 2009 and 2011, according to local press reports.

No one was injured in the derailment in 2009 but in 2011 the 11 people were lightly hurt, according to the reports.