Prospero uses his magical powers, connected to the "brave new world" of the deserted island on which he finds himself stranded, to enact poetic justice more than to revenge himself on his enemies. He uses his power not to inflict on his enemies all that he has suffered (they get only a taste of suffering) but to teach them a lesson and restore the proper order of life. His justice is restorative rather than punitive.
Prospero's main agent of justice is Ariel, a spirit he has freed from an evil spell. Ariel, in gratitude, serves Prospero faithfully. The action which starts the play's plot in motion is the storm Ariel raises at Prospero's behest. This magical storm forces the ship carrying Alonso and Antonio, Prospero's chief enemies, to crash on the island. Alonso, king of Naples, and Antonio, Prospero's brother, had conspired to depose him from rule, setting him and his daughter Miranda on a leaky vessel out to sea. Prospero ended up stranded on this deserted island, so it is only right (poetic justice) that Alonso and Antonio do so too.
Ariel enchants the boat so that the crew can't leave. We know the crew has an experience of practical matters that Alonso, Antonio, and the other aristocrats lack, so the main players will be all the more helpless. As it was for Prospero, they have only their own wits to rely on as they cope with an unknown land.
Prospero has Ariel set out a large banquet for Alonso, Antonio, and Sebastian, only to make it disappear as Ariel turns into a harpy and tells them to repent. The three are learning that everything is not as it seems. Used to being powerful, the men are helpless on the island, both from being in a strange place and due to Prospero's magic, which keeps them confused and disoriented. They learn greater humility through this experience and repent of their abuse of power. When they repent, Prospero gives up his magic as a prelude to returning to civilization. In another act of poetic justice, he fully frees Ariel, who helped free him from exile on the island.