WASHINGTON — Kweisi Mfume, a former Democratic congressman and president of the N.A.A.C.P., won a special election on Tuesday to represent Baltimore in Congress, reclaiming a seat he held nearly 25 years ago to finish the term of his successor, Representative Elijah E. Cummings, who died in October.

Mr. Mfume won the seat in a contest conducted predominantly by mail, with only three polling sites open because of safety concerns during the coronavirus pandemic. A former Baltimore city councilman, he was first elected in 1986 to represent Maryland’s heavily Democratic Seventh Congressional District, where he served until 1996, when he left to join the African-American civil rights group; Mr. Cummings won election to succeed him.

After winning a crowded Democratic primary, which included Maya Rockeymoore Cummings, the widow of the former representative, Mr. Mfume, 71, defeated Kimberly Klacik, a Republican strategist and member of the Baltimore County Republican Central Committee.

Ms. Klacik drew national attention in July after she assailed Mr. Cummings and showed footage of boarded-up houses and trash-strewn areas of Baltimore on “Fox & Friends,” prompting President Trump to label Mr. Cummings, then the chairman of the powerful House Oversight and Reform Committee, “a brutal bully” who represented a district that had become a “disgusting, rat and rodent infested mess.”