ZnO nanorods were grown hydrothermally on bare and NiO-coated p-GaAs substrate to fabricate p-n heterojunctions. The NiO intermediate layer was deposited using thermal evaporation technique. The X-ray diffraction patterns revealed that ZnO nanorods grown on the bare p-GaAs do not have any preferential orientation along the c-axis, but those on the NiO-coated p-GaAs have preferential orientation along the c-axis, i.e. along the (002) direction. The scanning electron microscope images show that the NiO intermediate layer improved the uniformity and the alignment of the ZnO nanorods. Photoluminescence spectra demonstrated that increasing the thickness of NiO intermediate layer leads to improve the optical quality of the ZnO nanorods. Current-voltage characteristics showed that the presence of the NiO intermediate layer leads to increase the threshold voltage and decrease the leakage current of the n-ZnO nanorods/p-GaAs heterojunction. The energy band diagram of heterojunctions drown using Anderson model revealed that the NiO intermediate layer acts as an electron-blocking layer in the ZnO side and at the same time increases the hole injection from the GaAs to the ZnO side. Therefore, most of electron-hole pair recombination could occur at the ZnO site.