Fast food worker Gareth Crosskey gained access to the Disney star's profile in January 2011 by posing as Gomez's stepfather Brian Teefey, who administrates the page, and persuading Facebook bosses to reset her password.
Crosskey is alleged to have threatened Teefey with releasing several personal messages between Gomez and Bieber, who at the time had not confirmed their relationship.
The 21-year-old also accessed messages to Gomez's friend Demi Lovato and posted "Justin Bieber sucks" on the Wizards of Waverly Place star's wall.
Crosskey was tracked down after a £50,000 joint investigation between the Metropolitan Police's e-crime unit and the FBI, according to The Sun.
Crosskey claimed that he had been trying to shed light on Facebook security issues after his own profile was hacked, but still pleaded guilty to two offences against the Computer Misuse Act in London's Southwark Crown Court earlier this month.
Judge John Price told him: "You are clever with a computer and you hacked into the private part of somebody's Facebook account. Selena Gomez had a Facebook account on which she has six million friends.
"They have permission to get into part of the account and you hacked into the private part by getting the email password. People deserve privacy and should not have their private correspondence made public."
In 2011, Gomez was also targeted by a stalker who claimed to have "over 50 conversations with God a day about killing" her. She obtained a long-term restraining order against the individual, Thomas Brodnicki, in January.