Greenhalge was elected mayor of Lowell in 1880 and 1881 and was an unsuccessful candidate for election to the Massachusetts Senate in 1881. He was a delegate to the Republican National Convention in 1884 and a member of the Massachusetts House of Representatives in 1885 but was unsuccessful in his bid for reelection. He became city solicitor in 1888, practicing law in Middlesex and other counties. He was elected as a Republican to the Fifty-first Congress, serving from March 4, 1889 to March 3, 1891, but failed in 1890 to be re-elected to Congress, a casualty of that year's Democratic landslide.