The code raises the age at which girls can legally marry from 15 to 18 and gives wives "joint responsibility" with their husbands in family matters.
Approval by the Senate means the bill - which also says polygamy can only be practised under highly restrictive conditions and makes it more difficult for men to divorce their wives - can now become law.
The revised legislation replaces a family code, the moudouana, that women's groups accused of making Moroccan women perpetual minors, under the authority of men.
The code's prime mover King Muhammad VI has stressed it is in line with the tenets of Islam, but Islamists have complained it contravenes religious teachings.
The new code claims to underline the principle of "equality of rights and duties" within the marriage and abandons the principle of the "wife's obedience to her husband".
While polygamy is not completely outlawed - a man may take a second wife as soon as his first wife submits a request for divorce on grounds of "wrongs suffered" - women will be able to draw up a pre-nuptial agreement that forbids husbands from taking another wife.
"Ruling out polygamy is the principle, its authorisation an exception," Justice Minister Muhammad Buzuba told senators. The code also outlines the concept of divorce by "mutual consent".
It offers a new guarantee for wives, giving them the possibility of drawing up a contract to share out goods acquired during marriage in the case of divorce.
Critics have countered that while this may deter men from too readily divorcing their spouses, it will also act to discourage potential husbands from marrying.
The new law also offers new rights for the protection of children, notably the right of women to have custody of their offspring and the right for children born out of wedlock to trace their fathers.
Specialised family courts will oversee the new code.