Twilight Sparkle and her friends have been invited to the Princess Summit at the Crystal Empire with Princesses Celestia, Luna, and Cadance. Twilight, still coming to accept her new wings and title as Princess, is reluctant to take her role.
That evening, a thief tries to steal Twilight's crown, the Element of Magic, but trips over Spike's tail. This wakes Twilight, and in the ensuing chase, the thief reveals herself as Sunset Shimmer, a unicorn and former student of Celestia who became bitter and angry. In their tussle, the crown falls through a magic mirror, and Sunset jumps right in after it. As the others come to investigate, Celestia explains that the mirror is a portal to another world, but only remains open for three days every thirty moons. Several years ago, when Sunset became dissatisfied with being Celestia's student, she jumped through the portal and hadn't been seen since. Celestia implores Twilight to go through and get the crown, as without it, the rest of the Elements will not function to protect Equestria. However, she fears sending any more help through with her would unbalance the two worlds. After quickly saying her goodbyes, Twilight steps through—followed by Spike, who chases after her.
The two come to their senses, and find that Twilight has become human and Spike a dog, a shock to them both. After an embarrassing moment where she tries to run like a pony, Twilight starts to get used to her body and quickly realizes that she cannot perform any magic, and heads towards the large Canterlot High School building nearby (which she mistakes as a castle). The two are confused by what is otherwise a normal high school as the other students just go about their business. She accidentally bumps into a boy, who helps her up.
Twilight and Spike continue to look around the school, and find a human Sunset Shimmer, clearly the Alpha Bitch of the school, accosting Fluttershy about what she did with the crown. Twilight steps in and defends Fluttershy, forcing Sunset away. Twilight quickly befriends Fluttershy, who helps her to get used to the school. She further explains she had found the crown and given it to Principal Celestia, who plans to give it as the prize for the winner of the Princess of the Fall Formal, a contest Sunset has won three years in a row.
Twilight realizes if she were to tell Principal Celestia the truth, she would be seen as a lunatic, so she resolves to run for Princess of the Fall Formal and win it to get her crown back. She starts to meet the human versions of her other friends, but finds they hold great animosity towards each other. Sunset Shimmer meets her and reveals she knows who Twilight is, and taunts her on how she doesn't understand how the human world works, while Sunset has had years of practice and practically rules the school, so Twilight has no chance of winning the contest. When Twilight is unable to operate a vending machine that Trixie easily buys a snack from, she decides Sunset is right, so she goes to the library and tries to research the human world. Snips and Snails, on Sunset's orders, record Twilight as she still struggles to cope with the human world, such as trying to understand how to use a computer. As night falls, Spike helps make Twilight a bed out of books in a dark corner of the library. They read a yearbook, and learn that Fluttershy, Rarity, Applejack, Rainbow Dash, and Pinkie Pie were all once friends as children, and wonder why they aren't friends now.
The next morning, all the students laugh at a confused Twilight. Rarity, Fluttershy, Pinkie Pie, and Applejack explain that Sunset posted a video online of Twilight awkwardly trying to adapt to the human world, making her look like a fool. The four offer to help her run against Sunset, but then go at each other's throats. Twilight encourages the four to talk to each other, and they realize their grievances were all a bunch of misunderstandings, and figure Sunset Shimmer manipulated things to drive them apart and stop them from uniting against her.
After they meet Rainbow Dash and patch things up with her, she says she'll only help Twilight become Princess of the Fall Formal if she can beat her in a one-on-one soccer game. Twilight loses miserably, but Rainbow explains that she was testing Twilight for heart and determination, and she passed.
The six gather at a cafe to discuss how to boost Twilight's popularity so she can win votes. Twilight bumps into the boy who helped her earlier, and they clearly have a mutual attraction. As he leaves, the girls explain he is Flash Sentry, Sunset Shimmer's ex-boyfriend. Rarity comes up with costumes and a routine to unite the students in school spirit, which is a raging success. The students are happier than they have been in a long time since Sunset arrived.
A short time later, Sunset reveals the school gym where the Fall Formal will be held has been trashed, and shows Vice Principal Luna photos seemingly depicting Twilight as the culprit. Luna takes Twilight to her office and reprimands her. Just in time, Flash arrives with evidence that the photos were doctored. Twilight is extremely grateful, and Flash asks if she wants to be his date for the Formal. She is about to accept, but when Luna comments that the damage to the gym will force the Formal to be postponed, she panics and runs away screaming "No!"
Twilight explains to Spike that the portal will close tonight, so if she can't get the crown back by then, they will be trapped for thirty moons. Spike suggest they tell their friends the truth so they will know what is at stake, but she is worried they will reject her. He tells her it will be fine, so she gathers her courage and tells them. Naturally, Pinkie Pie is the only one who believes her, until Spike gets fed up and talks to them. Now convinced, they rally the students into helping to restore the gym. The Fall Formal is back on schedule.
The night of the Formal arrives, and in new dresses made by Rarity, the six join in the festival. Since Sunset never showed up, Twilight is named the Princess of the Formal, but as she is about to be crowned, Sunset, Snips and Snails arrive and kidnap Spike. The six chase them to the front of the school where the portal is. Sunset brandishes a sledgehammer and threatens to destroy the portal unless Twilight surrenders the crown and leaves this world. To her shock, Twilight refuses; Equestria will survive without her, but Sunset was able to rule the school without magic, so she doesn't want to abandon this world to a Sunset with magic. Sunset angrily tackles her and the crown goes flying. Everybody plays Keep Away with it, but Sunset manages to grab it. She dons the crown and is blasted with a surge of magical energy, transforming her into a demonic creature. After quickly converting Snips and Snails to henchdemons, she uses her newfound powers to blast open the side of the gym and brainwash the other students to her will, then announces her plans to use her brainwashed army to conquer Equestria. Sunset tries to deal with Twilight once and for all by hurling a giant fireball at her, but she and her friends are protected by the magic of the crown. Twilight explains that although Sunset is wearing the crown, she cannot control it because it runs on The Power of Friendship, which Sunset lacks. Magic courses through the crown and transforms the six friends into pony-human hybrids, and the friendship between them is able to exorcise the demonic powers from Sunset, reverting everyone else to normal.
As the others come back to their senses, Sunset apologizes for the trouble she caused, and Twilight implores her new friends to bring Sunset into their group and teach her about friendship. Still, someone has to fix the school, and Vice Principal Luna tasks Sunset, Snips and Snails to do just that. The Formal gets back underway, with the Mane Six still in their half-pony forms. Twilight and Flash share a dance. After the Formal, Twilight and Spike say their goodbyes and return back through the portal with the crown. As the portal closes, her friends revert to normal humans. Twilight is warmly greeted by her pony friends and congratulated by Celestia for completing the task. Though exhausted, Twilight considers her role as a Princess to not be as bad as she originally thought.
As Twilight is telling her friends about her adventure, she bumps into a pegasus guard who seems familiar. Princess Cadance identifies him as Flash Sentry, causing Twilight to blush. Her friends tease her about her crush, which she takes in good humor.