The Eastern Railroad built their Gloucester Branch in 1847, reaching Gloucester on December 1. The station was located in downtown Gloucester, at the intersection of Railroad and Maplewood Avenues. Gloucester was the end of the line until November 4, 1861, when the Rockport Railroad extended the branch to Rockport station. Due to the new curve heading to Rockport, a new station was built to the west near Washington Street. The old depot, now on a short spur, was still used for freight service for several decades to come. Initially, Rockport trains were operated by the Eastern Railroad and met Eastern mainline trains at Beverly. In 1864, trains began to be through-routed to Boston to increase frequencies on the inner part of the trunk line. The Eastern Railroad bought the Rockport Railroad in 1868, but the branch is still known as the Gloucester Branch. By the 1870s, regular commuter service was available. The Eastern was leased by the Boston and Maine Railroad in 1885 and merged into it in 1890. In 1911, the branch was doubled-tracked to Gloucester.. Commuter service continued in the same fashion for decades, with 13 inbound round trips in 1906, 14 trips in 1950, and 11 trips in 1962.
MBTA era
Gloucester has seen nearly continuous service to Boston since 1848, with only 2 interruptions. When the newly formed MBTA began funding commuter rail service in 1965, communities outside the funding district were left to pay for trains to continue stopping. Gloucester and neighboring Rockport initially declined to subsidize service. Service past Manchester was discontinued on January 28, 1965, along with the outer sections of the Fitchburg Line and Central Mass Branch. The MBTA rushed to reach subsidy agreements with out-of-district towns, and after negotiations service was to resume on June 6. After a lawsuit in which the Eastern Massachusetts Street Railway challenged the right of the MBTA to provide out-of-district service, Rockport service resumed on June 28, 1965. The MBTA bought most B&M commuter assets, including the Gloucester Branch, on December 27, 1976. On January 20, 1984, the North Station approach trestles were destroyed by a fire. Gloucester Branch trains were terminated at a temporary station near Sullivan or bussed from Lynn. On November 16, 1984, the Beverly Draw bridge connecting Salem to Beverly burned, cutting the Rockport Branch and the Ipswich Line from the rest of the system. A shuttle train was run from Rockport to Beverly Depot until January 7, 1985, when it was replaced by bus service. The locomotives used were then trucked to Danvers so they could be repaired at the MBTA's main maintenance facility. A new bridge opened on December 1, 1985, reconnecting Gloucester to the larger system. On June 3, 2004, the MBTA board approved a renovation of the station, including new parking spaces, lighting, and signage, as well as a "mini-high" platform for handicapped accessibility. The $3.4 million rebuilt station was opened in September 2005. On April 29, 2020, service between West Gloucester and Rockport was indefinitely replaced by buses due to a failure of the old bridge. That June, the MBTA indicated the closure would continue until the completion of the bridge replacement in mid-2021.