The New York and Erie Rail Road was chartered April 24, 1832, by Governor of New York, Enos T. Throop to connect the Hudson River at Piermont, north of New York City, west to Lake Erie at Dunkirk. On February 16, 1841, the railroad was authorized to cross into the northeast corner of Pennsylvania on the west side of the Delaware River. Construction began in 1836 and was opened in sections until reaching the full length to Dunkirk May 19, 1851. At Dunkirk steamboats continued across Lake Erie to Detroit, Michigan.
When the route was completed in May 1851, President Millard Fillmore and several members of his cabinet, including Secretary of State Daniel Webster, made a special, two-day excursion run to open the railway. It is reported that Webster viewed the entire run from a rocking chair attached to a flatcar, with a steamer rug and jug of high-quality Medford rum. At stops, he would get down and speechify.
The line was built as 6 ft (1,829 mm) wide gauge; this was believed to be a superior technology to standard gauge, providing more stability.
In 1848 the railroad built the Starrucca Viaduct, a stone railroad bridge over Starrucca Creek in Lanesboro, Pennsylvania, which has survived and is still in use today. The viaduct is 1,040 feet (317 m) long, 100 feet (30.5 m) high and 25 feet (7.6 m) wide at the top. It is the oldest stone rail bridge in Pennsylvania still in use.