Six wagons, including tanker cars carrying acid and other chemicals used by industry, derailed at 2.54am on Saturday in the station of Daillens, 17 kilometres northwest of Lausanne, SBB said.
No-one was injured but the derailment caused extensive damage, the state-owned rail operator said.
Five of the cars flipped on their sides and chemicals leaked out of two of them.
State broadcaster RTS reported that 25 tonnes of sulphuric acid emptied out of one tanker car.
An environment official from the canton of Vaud said there was no risk to the local population.
A cleanup team has begun mopping up the spill and clearing the tracks but SBB said it would take several days to repair damage to 300 metres of rails that need to be replaced, in addition to signalling equipment and cable.
For commuters on Monday, shuttle buses will be put in place for part of the route for passengers travelling between Lausanne and Yverdon, SBB said.
Trains on the Pied du Jura line to and from Neuchâtel and Biel/Bienne will be routed via Bern and not via Yverdon, the rail operator said.
The TGV to Paris from Lausanne was redirected via Geneva.
Freight trains are also being rerouted while the repairs continue.
An investigation is ongoing into the cause of the derailment of the freight train, which consisted of a locomotive hauling 22 railway carriages, SBB said.