The final expulsion of gas by a star as it forms a planetary nebula-the ionized shell of gas often observed surrounding a young white dwarf-is one of the most poorly understood stages of stellar evolution [1,2]. Such nebulae form extremely rapidly (about 100 years for the ionization) and so the formation process is inherently difficult to observe. Particularly puzzling is how a spherical star can produce a highly asymmetric nebula with collimated outflows. Here we report optical observations of the Stingray nebula [3,4], which has become an ionized planetary nebula within the past few decades . We find that the collimated outflows are already evident, and we have identified the nebular structure that focuses the outflows. We have also found a companion star, reinforcing previous suspicions that binary companions play an important role in shaping planetary nebulae and changing the direction of successive outflows .