The nanostructured ZnO film was prepared on a texturized Si wafer by a simple sol–gel method to fabricate n-ZnO/p-Si heterojunction photoelectric device. The novel sol–gel method is cheap and convenient. The structural, optical and electrical properties of the nanostructured ZnO film were studied by XRD, SEM, XPS, PL, UV–Vis spectrophotometer and Hall effect measurement. The current–voltage (I–V) curve of nanostructured ZnO/p-Si heterojunction device shows good rectifying behavior. Good photoelectric behavior is obtained.