The ruling puts in doubt thousands of same-sex marriages that have taken place in California
Californian voters have chosen to ban same-sex marriage, months after it was legalised by the state's top court.
The measure restricting marriage to heterosexual couples gained 52% support - more than 5.1 million votes - with nearly all precincts declaring results.
Twenty-seven US states already ban same-sex marriage. California's legal approval had seen thousands of gay couples wed there since May.
State Attorney General Jerry Brown has said those marriages will remain valid.
Legal challenges to the measure, known as Proposition 8, are likely.
The referendum called for the California constitution to be amended by adding the phrase that: "Only marriage between a man and a woman is valid or recognised in California."
The ballot measure was keenly fought with more than $70m spent on advertising by both sides - breaking national records for campaigning on a social policy initiative.
The BBC's Peter Bowes in Los Angeles says that for many liberal Californians, on a day when Barack Obama was swept to victory, the election was a bittersweet experience.
He said they won the White House - but lost on an issue many believed had already been resolved by the courts.
Conservative groups have welcomed the ban.
"People believe in the institution of marriage" said Frank Schubert, co-manager of the Yes on 8 campaign.
"It's one institution that crosses ethnic divides, that crosses partisan divides."
But gay rights supporters vowed to fight on.
Kate Kendall, executive director of the National Center for Lesbian Rights said "there has been enormous movement in favour of full equality in eight short years".
"That is the direction this is heading, and if it's not today or tomorrow, it will be soon," she added.
Florida and Arizona also backed proposals to ban gay marriage, by 62% and 56% respectively, on 4 November.
The measure was among 153 state-level proposals up for vote on US presidential election day.
Other measures under consideration by 36 states ranged from initiatives on gambling, drug laws and stem cell research to tax laws and affirmative action on race.
There were 59 such initiatives in 2008.
In South Dakota and Colorado, measures curtailing abortion rights were rejected.
Michigan voted to allow medical use of marijuana, while Nebraska voted to end race- and gender-based affirmative action.
In Oregon, a measure designed to limit teaching of students in language other than English to no more than two years was defeated.
Washington state voted to allow doctor-assisted suicide for terminally ill people.
Amid deep economic uncertainty, proposals to cut state income taxes were defeated decisively in North Dakota and Massachusetts.
Missouri repealed a $500 loss limit designed to protect compulsive gamblers on riverboats.