The itinerary lasts 5hrs 57min, and has 2 steps.

Montpellier - Barcelone
The step from Montpellier to Barcelone lasts 3hrs 10min. You'll travel in a high speed train.

Barcelone - Valence (ES)
The step from Barcelone to Valence (ES) lasts 2hrs 47min. You'll travel in a regional train.