Californians also sent the first black woman to the United States Senate since Carol Moseley Braun in 1999. Attorney General Kamala Harris easily defeated Representative Loretta Sanchez in the state’s first Democrat-only race, the result of the top-two primary system.

“I intend to fight for a state that has the largest number of immigrants, documented and undocumented,” Ms. Harris told a crowd of supporters. “Our ideals are at stake right now — and we need to fight for our ideals.”

California will join four other states and the District of Columbia where recreational marijuana is allowed, and the decision could open the door to federal legalization.

The passage of the measure will allow residents older than 21 to grow up to six cannabis plants at home and an ounce of marijuana. It also allows the state, county and city government to regulate and tax the growth and sale of marijuana.

Voters also passed a measure supported by Gov. Jerry Brown that would increase the number of nonviolent inmates eligible for parole and allow the inmates to earn credit for good behavior. The measure was aimed at reducing the state’s prison population and rolling back some of the tough-on-crime measures Governor Brown once championed.