In 1905 Kansas, Oscar "Oz" Diggs works as a small-time magician in a traveling circus. As a storm approaches, the circus strongman learns Oscar has flirted with his wife and goes to attack him. Oscar escapes in a hot air balloon, but is sucked into a tornado that takes him to the Land of Oz. There the witch Theodora believes him to be a wizard prophesied to overthrow the Wicked Witch who killed the King of Oz. En route to the Emerald City, Oscar flirts with Theodora, who falls in love with him, wishing to be his queen when he rules Oz. They encounter the flying monkey Finley, who pledges a life debt to Oscar when he saves Finley from a lion.
Upon reaching the Emerald City, Oscar meets Theodora's sister Evanora, who is skeptical of Oscar being the foretold savior. Evanora tells Oscar that the Wicked Witch resides in the Dark Forest and can be killed by destroying her wand, the source of her powers. Oscar and Finley are joined en route to the forest by China Girl, a young, living china doll whose home and family were destroyed by the Wicked Witch. The three reach the forest and, upon retrieving the wand, discover the "Wicked Witch" to be Glinda the Good Witch, who tells them Evanora is the true Wicked Witch. Evanora sees this with her crystal ball and manipulates Theodora against Oscar by magically creating a replica of the music box Oscar had previously given Theodora (as well as every other woman he had ever met) and also by showing Theodora an image of Oscar with Glinda, saying he is trying to court all three witches. She offers the heartbroken Theodora a magic apple she promises will remove her heartache. Theodora bites into it, realizing too late that Evanora was the true Wicked Witch all along, and transforms into a heartless, green-skinned Wicked Witch as the apple causes her heart to shrivel up and die.
Glinda brings Oscar's group to her domain in Oz to escape Dark Queen Evanora's army of Winkies and flying baboons. She confides to Oscar that she knows he is not truly a wizard. However, she still believes she can still help them stop Evanora, and provides him an "army" of Quadlings, tinkers, and Munchkins to do it. Theodora enters Glinda's domain and angrily reveals her new, hideous appearance to Oscar before threatening to kill her and her allies with the Emerald City's well-prepared army. Oscar despairs that her army cannot defeat the Wicked Witches, but after telling China Girl about the exploits of his hero Thomas Edison, he realizes they can fight using prestidigitation.
Glinda and her subjects mount a mock attack on the Wicked Witches' castle using an automated army of scarecrows blanketed by thick fog. The Wicked Witches are tricked into sending their flying baboons through a poppy field that puts the baboons to sleep. However, two baboons manage to capture Glinda, who is brought to the city square and enchained. Meanwhile, Oscar infiltrates the Emerald City with his allies, only to seemingly abandon them in a hot air balloon loaded with the king's gold, which Theodora destroys with a fireball. Oscar then secretly reveals himself to his friends, having faked his death. Oscar uses a hidden smoke machine and image projector to present a giant, holographic image of his face as his "true" form, and a fireworks display to attack and intimidate the Wicked Witches. Evanora fearfully hides in her castle while Theodora flees on her broom, unable to hurt the "invincible" wizard; Oscar says Theodora is welcome back should she find good in her heart again. Glinda is freed by China Girl and defeats Evanora, destroying the Wicked Witch's emerald necklace that hides her true, crone-like appearance. The banished Evanora is carried off by the two remaining flying baboons.
The film concludes with Oscar, now King of Oz, using his projector to sustaining the beliefs he is still a powerful savior and keeps the citizens of Oz united against the Wicked Witches. He also presents gifts to his friends: Master Tinker, who helped build his machines, receives Oscar's camping-tool jackknife; Knuck, the grumpy Munchkin herald and an ally of Glinda, receives a mask with a smiley face; the long-suffering Finley receives Oscar's friendship; and China Girl accepts her friends as her new family. Finally, Oscar takes Glinda behind the curtains of his projector and kisses her.