William Brainerd Spencer (February 5, 1835 – February 12, 1882) was an attorney and politician of the planter class, elected as U.S. Representative from Louisiana in 1876, in a contested election decided in his favor and against the Republican Party candidate. That year the Democratic Party regained control of the Louisiana state legislature.
He resigned when appointed in 1877 as Associate Justice of the Louisiana Supreme Court, serving until 1880. After that he resumed the practice of law.
Born on "Home Plantation," in Catahoula Parish, Louisiana, Spencer received his early schooling under private tutors. His parents were slaveholders. He was graduated from Centenary College, Jackson, Louisiana, in 1855 and from the law department of the University of Louisiana at New Orleans (now Tulane University) in 1857. He married Henrietta Elam, sister of Joseph Barton Elam, who would later serve in the United States Congress.
Spencer was admitted to the bar in 1857 and commenced practice in Harrisonburg, Louisiana. He served in the Confederate States Army, with the rank of captain, until 1863, when he was captured. He was held as a prisoner of war at Johnson's Island, Ohio, until the close of the Civil War.
After returning to Louisiana, Spencer resumed the practice of law in Vidalia, in 1866. He successfully contested as a Democrat a special election against Republican Frank Morey. He was elected to the Forty-fourth Congress and served from June 8, 1876, to January 8, 1877, when he resigned to accept a judicial appointment.