Christopher Chaney (35) was sentenced in Los Angeles after US District Judge S James Otero heard from a tearful Johansson in a videotaped statement.
The actress said she had felt "truly humiliated and embarrassed" when topless photographs she took of herself, which were intended for her then-husband Ryan Reynolds, were placed on the internet as a result of the hacking.
Some of Aguilera's private photographs appeared online after Chaney sent an email from the account of her stylist, asking the singer for scantily clad images. Before the sentencing Aguilera said: "That feeling of security can never be given back."
Chaney, a former office clerk from Jacksonville, Florida, was arrested in October 2011 as part of an investigation dubbed "Operation Hackerazzi".
He was initially charged with 28 counts related to hacking but struck a plea deal with prosecutors, pleading guilty to nine counts including wiretapping and unauthorised access to protected computers. He was ordered to pay $66,179 (€50,044) in restitution to victims.
Chaney also targeted two women he knew, sending nude pictures of one former co-worker to her father.
The women described him as "calculated, cruel and creepy".
Chaney said he had become addicted to spying on the personal lives of celebrities.
He said: "I don't know what else to say except I'm sorry. This will never happen again." (© Daily Telegraph, London)