A miller boasts that his daughter can spin straw into gold. The king hears of this and sends for her and tells her that if she does not do so at once, he'll chop her head off. Then she is left alone in a room with a spinning wheel and a pile of straw. A little man appears and asks her what he will get if he spins the straw for her. On the first night, she gives him a necklace, on the second night, a ring. On the third night, she has nothing left, so she has to agree when he demands her first child.
The king and the miller's daughter are married, and she bears a child. The little man comes to collect his reward, but she weeps and wails until he agrees to give the child back if she can guess his name in three days. On the third day, one of her servants relates a curious little tale about a little man dancing around his bonfire, and singing a song about how his name is Rumpelstiltskin.
When she guessed his name, he was so cross that he stomped his foot hard enough to sink it into the ground. In his rage, he grabbed hold of the other foot, and tore himself in half.