Wagner was elected as a Whig to the Twenty-sixth Congress (March 4, 1839 – March 3, 1841). He served as chairman of the Committee on Expenditures in the Department of War (Twenty-sixth Congress). He continued the practice of law at Fort Plain until May 1873, when he retired. He died at Fort Plain, New York, September 13, 1884. He was interred in Fort Plain Cemetery.