NASHVILLE — Megan Barry, a liberal member of the consolidated city-county council here, was elected mayor Thursday, besting a more conservative opponent in a contest in which bouts of mudslinging threatened to overshadow pressing issues of growth and development in the booming city.

Thursday’s runoff election pitted Ms. Barry, 51, an eight-year veteran of the Metropolitan Council, against David Fox, 54, a former hedge-fund manager. Ms. Barry became the first female mayor in Nashville history. Mr. Fox conceded Thursday night as Ms. Barry had earned about 55 percent of the votes with roughly two-thirds of the precincts reporting, The Associated Press reported.

Though the pair had much in common, particularly on social issues — both favor same-sex marriage and abortion rights — Mr. Fox and his supporters worked to portray Ms. Barry as too liberal for Nashville, and Ms. Barry tried to portray Mr. Fox as too conservative, lending the officially nonpartisan contest a decidedly partisan flavor.

As a result, many here saw the race as a kind of barometer of a unique local political culture that contains liberal and conservative strains: Though Nashville is home to the conservative Southern Baptist Convention, and is the capital of a state in which Republicans dominate the government, residents overwhelmingly chose Barack Obama over Republican opponents in the 2008 and 2012 presidential elections.