In the Catholic tradition, God’s “maleness” is understood in relation to everything else’s “femaleness”–or, as Mangetout said, it’s a role-function thing.
It’s important to realize that in terms of strict definition, “sex” is a matter of biology, while “gender” is a matter of function. So, for example, many things can have a gender without having a sex, although certainly all things with a sex have a gender. So take, for example, pipe fittings at the hardware store. You’ll notice that some are designated “male” and others “female.” Why? Because one is a donor (it goes in) and the other a recipient. The designation isn’t intended to be sexual, although the metaphor should cause your inner junior-high student to get the giggles.
So, back to God: the original Genesis story portrays God as an entity that, well, goes IN to His creation, creates human life, and then pulls out. You’ll notice that while God can go walk around in Eden, he’s not really of it. God is the “male” by placing himself within creation (the “female”) and helping new life come out of it. (Yes, I realize that you can creatively play around with things such that God has female aspects–but suffice it to say that this is how the Hebrews understood things.)
The metaphor continues into the New Testament with Christ (who, remember, is God-made-man) as the “male” figure–both in body and in function–and the human race as “female.” Not to freak the men out, but YES, that includes us. The image used both by Christ and Paul is that Jesus is the bridegroom (WHY they call it a bridegroom, I dunno–he’s the groom, anyway) and the human race as the bride. Christ lives for the human race just as a man traditionally was to live for his wife, in a spirit of giving and if necessary, sacrifice. The bride, in turn, fully accepts the groom’s love and returns it in full through fidelity.
So, in short, Christ = groom, human race = bride. Groom loves bride, bride loves groom back. Everyone’s happy.
It’s speculated by some Catholic theologians, the Pope among them, that this is WHY God divided the human race into two sexes. Our sexuality is meant to be a living metaphor for God’s relationship to His people. Hence, this is why marriage is given sacramental status in the Catholic tradition: the sexual encounter between man and wife is understood as an encounter with Christ himself. (Freaky, eh? God’s in the bedroom. Don’t mind Him, though, it’s not like He hasn’t seen it before.)