Perry, who was married to British comedian Russell Brand for 14 months before they parted ways in 2011, says she found her strength in the track, reports femalefirst.co.uk.
"Imagine what happens when you go through a break-up. We all go through break-ups and we all get very depressed and desperate. The lyrics are very exact and autobiographical," Entertainment Weekly magazine quoted Perry as saying.
"That's how I write. But the one thing about those lyrics is you can hear me finding my strength throughout the song. It starts off really low and then I kind of stand up for myself and say, 'No!'," she added.
"By the grace of god" is from Perry's album Prism. She is currently dating singer John Mayer.