The single-crystal n-type and p-type ZnO nanowires (NWs) were synthesized via a chemical vapor deposition method, where phosphorus pentoxide was used as the dopant source. The electrical and photoluminescence studies reveal that phosphorus-doped ZnO NWs (ZnO:P NWs) can be changed from n-type to p-type with increasing P concentration. Furthermore, we report for the first time the formation of an intramolecular p-n homojunction in a single ZnO:P NW. The p-n junction diode has a high on/off current ratio of 2.5 x 10(3) and a low forward turn-on voltage of approximately 1.37 V. Finally, the photoresponse properties of the diode were investigated under UV (325 nm) excitation in air at room temperature. The high photocurrent/dark current ratio (3.2 x 10(4)) reveals that the diode has a potential as extreme sensitive UV photodetectors.