Is this blasphemy

I remember when I was younger my grandma said something along the lines of “if someone was going to kill you but they would spare your life if you denied your faith, what would you do?” And I said I would just say I don’t believe in god even though I actually do, in order to live. She told me that that would be blasphemy is that true?

I’m atheist now I just have been wondering abt that for awhile