London Breed campaigned on her modest upbringing and a pledge to address the overwhelmingly white and Hispanic city's housing crisis, winning with just over 50 percent of the vote.
"No matter where you come from, no matter what you decide to do in life, you can do anything you want to do," the 43-year-old, who will be the only female mayor in the 15 largest US cities, said.
"Never let your circumstances determine your outcome in life." Breed, formerly president of the San Francisco Board of Supervisors, ran on 5 June but the result was delayed a week because of the tight count.
Her rival Mark Leno, who would have been San Francisco's first openly gay mayor, conceded on Wednesday.
"She's a remarkable young woman. She's going to do a very fine job and we wish her the best. Her success is San Francisco's success," he said.
Famously progressive San Francisco has among America's most eco-friendly public policies and has declared itself a sanctuary to immigrants it considers persecuted by President Donald Trump's administration.
The San Francisco Chronicle said Breed's elevation was all the more significant because of the city's "insane cost of living, which has driven out much of the black middle class." Official statistics put the African American population at five percent, and most live in public housing, according to the Chronicle.
Breed, a moderate who has received financial support from Silicon Valley, joins a small club. Of the roughly 41,000 elected officials in the US, around two percent are estimated to be black women.
Last month, LaToya Cantrell became the first black woman elected mayor of New Orleans, which is 60 percent African American.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)