The Maricopa County Sheriff's Office says the girl's threat was posted on a YouTube channel owned by a transgender community in Toronto.
The owner of the channel contacted Toronto police who then tracked down the teen who had plans to gun down her schoolmates at Red Mountain High and kill herself.
According to Sheriff Joe Arpaio, U.S. detectives acted within hours of being alerted by officers in Toronto on Wednesday and visited the girl's home in Mesa, Ariz., some 32 kilometres from Phoenix.
Police say the girl was arrested after she admitted posting the threat.
They say the teen told officers she planned the attack well ahead of last Friday's school massacre in Connecticut, where 20 young children and six adults died in a shooting rampage.
Police say they found three handguns at the teen's home, but the weapons were released to the girl's father for safe keeping.
They said the girl's parents both told detectives that their daughter had a history of mental health issues, had been seen by a psychiatrist, and had recently been asking about where the guns were kept in the house.
The teen is being detained at a juvenile facility and is facing charges of one count of computer tampering and one count of threatening and intimidating.
"We were very fortunate on this occasion to prevent another possible mass tragedy," Arpaio said in a statement. "It takes more than just law enforcement though. We need the active co-operation of parents, members of the community, and friends and neighbours to effectively stop these potential disasters before they happen."