The California Assembly has become the first state legislature in the US to pass a bill endorsing gay marriages.
Controversy over gay marriage in California is long-standing
The 41-35 vote in favour by the Assembly follows a similar ruling by the state Senate last week. It comes after bitter debate over gay marriage.
Governor Arnold Schwarzenegger must now decide whether to make the bill law.
The US' first legal gay marriage took place last year, after a Massachusetts court ruled gay couples had the right to marry under its state constitution.
The bill approved by the California Assembly states that marriage is a civil contract between two people, rather than between a man and a woman.
Its supporters have compared it to previous civil rights campaigns such as ending slavery and giving women the right to vote.
The bill's sponsor, San Francisco Democrat Mark Leno, said: "Do what we know is in our hearts. Make sure all California families will have the same protection under the law."
However, opponents argue the bill goes against a public vote five years ago, in which Californians backed a proposition opposing the recognition of gay marriages in other states.
"History will record that you betrayed your constituents and their moral and ethical values," said Jay La Suer, a Republican member of the assembly.
'Last frontier of bigotry'
The legislation, which failed in the assembly by four votes in June, was boosted this time by the Senate's approval of a same-sex marriage bill last week.
Assembly member Paul Koretz, a Democrat, argued bans on gay marriage were "the last frontier of bigotry and discrimination, and it's time we put an end to it".
Gay and lesbian advocates welcomed the assembly's decision, and urged Mr Schwarzenegger to sign it into law.
The office of Mr Schwarzenegger, who has previously opposed gay marriage, issued a statement saying the governor believes the issue is best decided in the courts.
California already gives same-sex couples many of the rights and responsibilities of marriage if they register with the state as partners.
Last month, its highest court ruled lesbian parents have the same rights and duties towards their children in the event of a break-up as parents of the opposite sex.
More than 3,400 gay couples got married in San Francisco in February 2004 before the Supreme Court ordered a halt the following month.