"You're permitted to address the most important legal questions of the country and sometimes the world and in doing so, you make a difference in people's lives," Sotomayor said.
"I can't think of a better job," she told a Commonwealth Club audience in a sold-out noontime appearance at Herbst Theatre.
Sotomayor, 58, was appointed to the court by President Obama in 2009 and became the panel's first Hispanic and third female justice.
She previously served as a prosecutor, in private practice, as a federal trial judge and as a federal appeals court judge in New York.
Sotomayor's appearance was part of a nationwide tour to talk about her new book, "My Beloved World," which tells the story of her journey from a Bronx housing project to the court.
Her purpose in writing the book, she told the audience, is to "remember how I got here."
"I wanted people to be able to say, 'She's just like me. If she can do it, I can do something too,'" Sotomayor said.
"Not every kid is going to be president or on the Supreme Court, but every kid can find a path and enrich themselves by trying," she said.
Sotomayor did not talk about specific cases, but responded to questions from Stanford Law School Dean Mary Elizabeth Magill and the audience about her childhood, previous work and life on the court.
Her childhood challenges included diabetes diagnosed when she was seven, an alcoholic father who died when she was nine, and poverty.
But she was nurtured by her grandmother's love, Sotomayor said.
"Every child needs one person's unconditional love," said Sotomayor, who said she urges young people to "find someone you admire" to act as a mentor.
Sotomayor said she remembers childhood conflict between her parents, who met after immigrating to New York from Puerto Rico, but said writing the book enabled her to learn about "the romance between my mother and father that I had never heard."
After attending Catholic schools -- which Sotomayor said gave her "the chance to get to the start of the race and it changed my life -- she won a scholarship to Princeton, from which she graduated summa cum laude, and earned her law degree at Yale.
Racial slurs and sexism at the start of her career were "a big part of my life," Sotomayor said, but "I've learned not to give up."
On the topic of affirmative action, Sotomayor said, "Yes, I needed help, but once I got there I worked hard at it and I proved myself worthy."
Asked about the greatest challenge of being on the court, Sotomayor answered it is "realizing there is no court above you."
Judges on lower courts -- where Sotomayor served for 17 years -- have the comfort of knowing that "if you really get it wrong, there's a court above you" to correct it, she said.
Being on the court with the final word is an added burden, she said.
"I had not fully anticipated the importance of coming to my right answer" even while recognizing that her fellow justices might reach a different conclusion, Sotomayor said.
"I try my hardest to make my vote the answer I think is right," she said.