Klein has been the acting-mayor since the sudden death of Mayor Omar Ahmad due to a heart attack in May.
Councilman Matt Grocott was unanimously selected to replace Klein as Vice Mayor.
Klein was emotional as he accepted the position of mayor. "It's been a dream of mine for as long as I can remember," he said.
He added that his feelings were conflicted due to the circumstances. "It's a hard thing to wrap my head around," Klein said. "To get your childhood dream -- but the reason I got it is because I lost one of my best friends."
Klein referred to Ahmad as being like a big brother to him and he vowed to honor Ahmad's legacy as he finished out his term.
"I don't look at this as my term. I look at this, at the next months, as finishing out his term," Klein said. "Maybe one day I'll get one of my own, but these six belong to Omar."
Pixar Animation movie producer Brad Lewis was also sworn in as the newest city councilmember amidst jokes that his name plaque will have to be changed to add "Academy Award-winning" and that his acceptance was a marketing ploy for "Cars 2," his latest film.
Lewis, a former city councilman, was appointed on June 6 to serve the remaining months of Ahmad's council term.
"I'm really doing this out of honor and respect for Omar Ahmad, as well as my respect for the city of San Carlos," Lewis said. "Omar was my friend...We had a lot of heart-to-heart conversations over the years and I truly am sorry that it's under these circumstances that I'm back. I wish it was under different circumstances."