Court records show the "Wizards of Waverly Place" star was granted the order Thursday in Burbank, which is north of downtown Los Angeles. Thomas Brodnicki is required to stay 100 yards away from Gomez and her workplace until a Nov. 4 hearing, when the order may be extended for three years.
Gomez wrote in a sworn declaration that she is in "extreme fear" of Brodnicki.
The filings, first reported Monday by celebrity website TMZ, state police were notified by mental health workers that the 46-year-old had threatened to harm or kill the actress while on a psychiatric hold.
Attempts to reach Brodnicki were unsuccessful.