Yes, it is a substitute for God.
Isn't "gosh" a euphemism of "god" as "Oh, my god" might sound profane? If I remember correctly, I think I learned so.
11)W:Oh, my gosh!
M:What's wrong, honey?
W:Look at the fuel gauge. I think we're running out of gas.
It's an exclamation in the same way that "Oh my god" is. I don't think many people in the UK would regard "Oh my god" as profane as such, but there are still people who might consider it blasphemous. In my entire life, I have only encountered one person who was offended by "Oh my god".
Along the same lines, one of my friends told me that her grandmother used to say "Oh my ged" instead because she didn't like to say "Oh my god" but we have never heard anyone else use that.
Remember - if you don't use correct capitalisation, punctuation and spacing, anything you write will be incorrect.