Each level has a fireball and a target. Hit the target to open the exit, but you'll also trigger the wall to come closing in on you. Escape before it gets too close!
To throw the fireball, press X when you are standing near it. The ball will bounce off mirrors, so you need to rotate them to get the fireball to land in the right place. Press X when you are near a mirror to rotate it 90 degrees.
In later levels, you can make a clone of yourself by pressing B. Then you can use your clone as a platform to jump on. Watch out for monsters on the ground, and make your escape!