Twilight Sparkle visits the Crystal Empire with her friends from Ponyville for her first royal summit following her coronation as a princess of Equestria. That night, Sunset Shimmer, a rogue student of Princess Celestia, emerges from a mirror portal and steals Twilight’s crown, which is embedded with one of the magical Elements of Harmony that protect Equestria. After a chase through the castle, Sunset drops the crown through the portal and follows after it. The other princesses explain that the portal leads to an alternate world; as the other Elements of Harmony are unusable without the crown, Twilight is tasked with retrieving it from the other world before the portal closes for thirty moons. Despite Celestia’s insistence that Twilight must travel alone, Twilight’s dragon assistant Spike anxiously runs after her into the portal.
Twilight and Spike emerge in the other world in the form of a human teenager and dog, respectively. Twilight, struggling to adjust to her new body, investigates the nearby Canterlot High School and finds that the world is home to other humans, several resembling ponies in Equestria. Masquerading as a transfer student, Twilight defends the counterpart of her friend Fluttershy from being bullied by Sunset, who has long integrated herself within the school in human form. Twilight learns that Fluttershy has delivered the dropped crown to Principal Celestia, mistaking it for a prop meant for the elected ”princess” of the upcoming school dance, the Fall Formal. Determining that no one would believe her claims of being a pony from another world, Twilight receives Celestia’s permission to run for Fall Formal Princess against Sunset, the reigning princess, to recover the crown.
While continuing to explore school life, Twilight discovers that the counterparts of Fluttershy and her other Ponyville friends – Pinkie Pie, Applejack, Rarity, and Rainbow Dash – have all separated out of animosity towards each other. Sunset, learning of Twilight’s campaign against her, sends her cohorts Snips and Snails to record a humiliating video of Twilight behaving like a pony, which is posted online and viewed by the entire school. The counterparts of Twilight’s friends come to her aid, only to argue among themselves, revealing the cause of their rift to be a series of treacherous text messages and emails they supposedly sent each other. Through Twilight’s postulation, the five girls realize that Sunset sent these messages to deceive them. Reconciling, the five help Twilight perform a public dance routine for her campaign, which improves Twilight’s image.
In another attempt to undermine Twilight, Sunset wrecks the formal decorations in the school gymnasium and uses edited photographs to frame her for the act. Although Sunset’s ex-boyfriend Flash Sentry proves Twilight’s innocence, the formal is forced to be postponed the night after the portal to Equestria closes. Twilight and Spike reveal their true identities to the other five, convincing them to help urgently repair the damage. Under Twilight’s direction, they rally the other students and successfully get the formal back on schedule, earning Twilight even more of the school’s support.
On the night of the formal, Twilight wins the election and the crown, but Sunset steals it back in a scuffle after kidnapping Spike and threatening to destroy the portal to Equestria. Upon donning the crown, Sunset transforms into a demonic creature and hypnotizes the other students, revealing her intent to conquer Equestria with the school as her army. When Sunset attacks Twilight and her friends, their friendship activates the crown’s magic, shielding them and giving them pony-like ears, wings and tails. The six girls use their magic to revert Sunset and their schoolmates to normal. Sunset tearfully apologizes for her actions, humbled by the power of the girls’ friendship. After celebrating at the formal and placing Sunset under her friends’ care, Twilight and Spike return to Equestria with the crown as the portal closes, reuniting with their pony friends.