Gov. Jerry Brown signed a law making it illegal for people to post compromising images of their exes.
Lawmakers say the problem is going viral, with thousands of intimate photos and videos posted online in a fit of revenge.
The American Civil Liberties Union had opposed the bill, arguing it might restrict free speech rights.
The law, which takes effect immediately, makes it a misdemeanor to post identifiable nude pictures of someone else online without permission with the intent to cause emotional distress or humiliation.
The penalty is up to six months in jail and a $1,000 fine. Before the criminal law, Californians could sue their virtual assailants, but that can be expensive and time-consuming.
(The Associated Press contributed to this report)