U.S. District Judge S. James Otero sentenced Christopher Chaney in Los Angeles after hearing from a tearful Johansson in a videotaped statement.
The biggest spectacle in the case was the revelation that nude photos taken by Johansson of herself and meant for her then-husband Ryan Reynolds were posted online.
"I have been truly humiliated and embarrassed," Johansson said. "I find Christopher Chaney's actions to be perverted and reprehensible."
Chaney, 35, of Jacksonville, Fla., also targeted two women he knew, sending nude pictures of one former co-worker to her father. The judge noted the damage to the women was in some ways worse than what Chaney's celebrity victims endured.
The women, identified in court filings only by initials, wrote in letters to Otero that their lives have been irreparably damaged by Chaney's actions. One has anxiety and panic attacks; the other is depressed and paranoid. Both said Chaney was calculated, cruel and creepy.
"It's hard to fathom the mindset of a person who would accomplish all of this," Otero said. "These types of crimes are as pernicious and serious as physical stalking."
Chaney apologized in court but denied that he had sent naked photos of women he knew to their relatives.
"I don't know what else to say other than I'm sorry," Chaney said. "I could be sentenced to never use a computer again and I wouldn't care."
Chaney previously pleaded guilty to counts that included wiretapping and unauthorized access to a computer.
Actress and singer Renee Olstead said in court Monday that she attempted to kill herself after Chaney leaked nude photos of her. She said she had never before considered suicide.
"I just really hope this doesn't happen to someone else," she said, crying. "You can lose everything because of the actions of a stranger."
The accounts of the cybervictims served as a cautionary tale for those, even major celebrities, who snap personal, and sometimes revealing photos.
Aguilera said in a statement issued days before the sentencing that although she knows that she's often in the limelight, Chaney took from her some of the private moments she shares with friends.
"That feeling of security can never be given back and there is no compensation that can restore the feeling one has from such a large invasion of privacy," Aguilera said.
Prosecutors said Chaney illegally accessed the email accounts of more than 50 people in the entertainment industry between November 2010 and October 2011. Aguilera, Mila Kunis and Johansson agreed to have their identities made public with the hopes that the move would provide awareness about online intrusion.
Some of Aguilera's photos appeared online after Chaney sent an email from the account of her stylist, Simone Harouche, to Aguilera asking the singer for scantily clad photographs, prosecutors said.
Chaney was arrested in October 2011 as part of a yearlong investigation of celebrity hacking that authorities dubbed "Operation Hackerazzi." Chaney's computer hard drive contained numerous private celebrity photos and a document that compiled their extensive personal data, according to a search warrant.
He continued to pursue his victims after the FBI seized his computer, a factor Otero said warranted a harsher penalty.
Associated Press Writer Greg Risling contributed to this report.