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 per cent 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.
Russia says US plans to search its San Francisco consulate
"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.
Facebook to build housing in Silicon Valley for first time
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 per cent, 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 per cent are estimated to be black women.
Last month, LaToya Cantrell became the first black woman elected mayor of New Orleans, which is 60 per cent African American.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ