A state government has announced long-awaited upgrades to a 139-year-old rail line, pledging billions in spending five months out from election.