Part of the line initially opened in 1857 by the Geelong and Melbourne Railway Company. The line was progressively finished within the next two years, allowing trains to travel from Melbourne to Geelong. In April 1885, a short branch was opened off the Werribee line just past Newport to Williamstown Racecourse, and in November 1888, a branch was opened off the Racecourse branch to Altona, terminating at a station named Altona Beach. The construction of these lines played improtant parts in the development of Geelong and Melbourne's west during the 19th and 20th centuries, with the line continuing to be an important asset in the 21st century.
