Mayor Ed Lee, other city officials and Golden State Warriors basketball player Carl Landry were among those who attended the event and encouraged the teens to follow their dreams.
"You represent the incredible promise of our city," Lee said to the 20 or so students in attendance.
A total of 126 students from public housing graduated high school in San Francisco this year, according to the mayor's office.
Supervisor London Breed, who also grew up in public housing in San Francisco, told the teens to not let their economically disadvantaged circumstances stop them from achieving lofty goals.
"I know what it feels like to just want to walk away and give up, but you can't," Breed said.
Landry echoed that sentiment, saying he also grew up poor but worked hard and is now in the NBA, and helped the Warriors as a key member of the team in their recent playoff run.
"I'm standing here as a living witness to say it is possible," he said. "Don't let your past determine your future."
Five of the graduates who have already been admitted to two- or four-year colleges were given scholarships at the end of the ceremony.
The mayor also touted the city's summer jobs program for youths, saying there are an estimated 6,000 jobs and internships for San Francisco youth via partnerships with businesses and nonprofits.
Lee offered to write any letters of recommendation the students might need to get a job.
"We're proud of you," he said. "You are the best investment we could make in our city."