Ellen Page just scored what might've been a lifesaving victory against an alleged stalker -- who threatened to kill her online -- because a judge has ordered the man to stay the hell away ... or else.
TMZ broke the story ... the LAPD launched an investigation last year into threats made against the actress via Twitter -- threats like "I'm going to murder Ellen Page. She's dead."
The investigation yielded one suspect -- a man named Joshua Michael Myers -- who was ordered today not to contact the actress in any way for 3 years.
Ellen was present in court for the hearing.