Dropped by to say gender is your 'mental sex.' Sex is your 'physical sex.' Then again, on the Internet, I suppose the first matters more so than the latter. (Someone has probably already mentioned this, I presume.)
What Cspr means is that gender is in the mind, where as sex is what is biological. Sex, male and female, is what your body is. Gender, woman or man (or other, neither, both, etc), is how you perceive yourself. You may have a certain reproductive organ, but that doesn't mean that you associate with it. You may have female features, for instance, but feel as though you are a man, which you may demonstrate through the clothes you wear, activities you partake in, and possibly through your choice in partners.