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.
Space: the final frontier. These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before. — Captain James T. Kirk