Several weeks after returning to Kansas from the Land of Oz, Dorothy Gale looks out of her bedroom window and sees a bright and beautiful rainbow on the horizon. She notices that the rainbow is approaching her and Toto as both of them run towards it. Dorothy starts to see Glinda the Good Witch who tells Dorothy that she must return to Oz so that she can save Scarecrow, Tin Man, and Cowardly Lion. Dorothy and Toto reclaim the silver shoes as they find a note from Glinda and Princess Ozma stating that the silver shoes can take her to the Land of Oz and back for the Impassable Desert has taken away much of their power.
Dorothy and Toto arrive in the Land of Oz where the items that Dorothy has in her pocket are a small mirror, a safety pin, a glass bottle, and four of Aunt Em's home-made oatmeal cookies. Dorothy and Toto were wondering which direction should they take when they encounter a molasses-covered owl named Wiser. Wiser tells Dorothy that she is in Gillikin Country and tells her to head to Candy County and ask the Great Royal Marshmallow that rules over Candy Country. Arriving at Princess Gayelette's palace, Dorothy and Toto encounter the castle's Jester who welcomes them. The Jester tells them that Princess Gayelette and Prince Quelala have gone missing, adding that they disappeared during a party at the palace which had become haunted and points them in the direction of the castle. When Dorothy and Toto enter the palace, they find a wand that belonged to the Wicked Witch of the West lying on the table.
Dorothy reminds the Jester that jesters are supposed to make people happy causing the Jester to freeze in his tracks as the Wicked Witch of the West's ghost urges the Jester to turn Dorothy into a china doll. The Jester gives up the wand as the Wicked Witch of the West's ghost fades away. Thus, the spell is broken and everyone is returned to normal. Scarecrow, Tin Man, Cowardly Lion, and Toto rejoice now that the spell is broken. When the Cowardly Lion asks Dorothy on what she plans to do with the Wicked Witch of the West's wand, Scarecrow and Tin Man plan to keep the wand locked up in a case until they can give it to Glinda and Princess Ozma.
Dorothy returns to Kansas where they reunited with Aunt Em and Uncle Henry. The three of them then see a rainbow in the twilight sky which Dorothy hasn't seen before. Dorothy knows that is must be Princess Ozma, Glinda, and the Wizard of Oz's way of saying goodbye to her. The rainbow shimmered over the prairie with all the bright and true colors of the Land of Oz.

Question: How is the Wicked Witch's spell broken?
Answer: When the Jester remembers gives up the wicked wand.
Alternative answer: The Jester gives up the wand.