The IRT main line , which is considered to be the first New York City `` subway '' line , opened in 1904 ; however , the Ninth Avenue Line , a predecessor elevated railroad line , operated its first trial run on July 3 , 1868 . The first underground line of the subway opened on October 27 , 1904 , almost 35 years after the opening of the first elevated line in New York City , which became the IRT Ninth Avenue Line .