Chrissy Hart, whose daughter died in early March 2016, described how the Harry Potter series had provided comfort to her "beautiful daughter" after she was diagnosed with cancer.
The letter struck a chord with Rowling.
"I think I wanted to write because words were always my safe place," Rowling tweeted when sharing Hart's letter on Twitter.
"I only wish words could bring her back to you."
Rowling's tweet was favourited nearly 9,500 times within 20 hours of posting it.
It lead many other Harry Potter fans to share their own comforting experiences with her books.
"Your words saved so many people. And still," one person tweeted.
Another added: "You help many lives daily. The importance of Harry Potter goes far beyond what you even imagine."
One girl revealed she had been suicidal, but was helped by the words in Rowling's books.
"Your words are what saved my life when I was suicidal," she tweeted.
"I wouldn't be here without your wise words, they helped me become stronger."
Chrissy Hart's letter in full.
I write to you as a mother, a Mummy, of a beautiful little girl. I'm sure you hear people tell you all the time that your words, your imagination helped them, or their children, in some way. Maybe they were helped out of depression by your works, maybe they drew strength from the knowledge that Neville grew up to be a hero against all odds, maybe you taught a bookish boy that there are friends to be found between the pages of a novel.
I want to share with you what you taught my daughter, who was recently diagnosed with cancer. When I read her your stories, she didn't take to the clear distinction between good and evil, but instead loved the grey characters. You taught her that for every chemo she has to go through, there will be the opportunity to fly across a lake on a hippogriff. For every time her heart seizes with fear of pain, there will be me chasing it away with a patronus charm.
Your words built a castle for her to move into when the prognosis got worse.
Mrs Rowling, cancer threatened to take everything from my daughter, and your books turned out to be the fortress we so desperately needed to hide in.
And the things you taught me?
You made me realise that a mother's courage might come in the form of her tears. I might not have the physical ability to block her from what will take her away from me, but I can be loving and gentle like Molly, stoic in my affection like Minerva, protective and loyal like Hermione, and waiting to welcome her home like Lily.
But the most important lesson you have taught us both: cancer may take her away from me in just a few short weeks. I might not be able to spare her the pain. But for every child that is taken too early, people will come together, huddling close in a big group, wands held high to light the dark sky with the love they felt.
You built Hogwarts as a home for her to return to. And for me.
For that I shall remain forever gratefully yours,