We demonstrate the growth of phosphorus doped Zn 1-xMg xO nanowire (NW) using pulsed laser deposition. For the first time, p-type Zn 0.92Mg 0.08O:P NWs are likely obtained In reference to atomic force microscopy based piezoelectric output measurements, X-ray photoelectron spectroscopy, and the transport property between the NWs and a n-type ZnO film. A shallow acceptor level of ∼140 meV Is identified by temperaturedependent photoluminescence. A piezoelectric output of 60 mV on average has been received using the doped NWs. Besides a control on NW aspect ratio and density, band gap engineering has also been achieved by alloying with Mg to a content of x = 0.23. The alloyed NWs with controllable conductivity type have potential application In high-efficiency all-ZnO NWs based LED, high-output ZnO nanogenerator, and other optical or electrical devices. © 2009 American Chemical Society.