In her most recent release, “Difficult Women,” author Roxane Gay delves into the inner lives of women with unflinching honesty.

That same honesty was brought to life on Monday, when she told a sold-out crowd at the Carnegie Music Hall in Oakland that “writing was her saving grace.”

Ms. Gay, who also authored the essay collection “Bad Feminist” and the novel “An Untamed State,” spoke about her work and inspirations before her visit here.

“Confession leads to vulnerability, and in the stories in ’Difficult Women,’ the women are often laid bare by their confessions,” the author said via email in February. “You see through to the truth of their lives. It’s a thrilling and terrifying place as these women demand, for better and worse, to be seen.”

Advertise with us

In stories such as “North Country” and “Break All the Way Down,” the protagonists are living largely solitary lives, usually in an effort to withdraw from the world after tragedy strikes.

“I am drawn to isolation because I have always been quite lonely. I was shy and awkward as a child so it was hard to make friends. I’m still, in many ways, that same person and I’ve also often lived in rural places where as a black woman I am isolated for several reasons,” Ms. Gay said. “In my fiction, I have the creative space to articulate what isolation looks and feels like.”

Her awareness of what it means to be lonely, however, comes with a benefit for her characters: “Adolescent loneliness allows me to write toward vulnerability. It allows me to appreciate nuance in my work and to champion the underdog, the underappreciated, the unseen.”

Even though many of Ms. Gay’s stories may contain difficult themes, her focus on what it means to be happy gives many of her narratives a note of optimism in the vein of “what doesn’t kill you makes you stronger.” As she said last month: “My stories are often characterized as dark, and I understand why, but in nearly everything I write, there is hope and there are moments of joy. For my characters, happiness can be all sorts of things but primarily they find happiness by learning how to live and learning how to love and be loved despite the things they’ve endured.”

Or, as she put it Monday night: “I need to believe that beyond this age of American disgrace, there is grace.”