Superior Court Judge William D Stewart granted the order, which requires Thomas Brodnicki to stay away from the Wizards of Waverly Place star and not attempt to contact her.
Another judge dropped a felony stalking charge against the Brodnicki, 46, last year after determining prosecutors hadn't proven he had caused fear in the star. Stewart twice delayed issuing a civil order until Brodnicki had an opportunity to respond.
Gomez, 19, did not appear at Wednesday's hearing. She wrote in a declaration filed in October that she was in extreme fear after learning that Brodnicki had threatened to kill her while he was on a psychiatric hold.
Prosecutors later alleged he stalked the actress between July and October.
Stewart noted that Brodnicki filed a declaration in December essentially consenting to the protective order and that the man with a history of mental illness had received "due process."
He said Gomez had reasonable cause to afraid of Brodnicki, who did not attend Friday's hearing.
The order also covers Gomez's family.