We present a robust method to estimate the redshift of galaxies using Pan-STARRS1 photometric data. Our method is an adaptation of the one proposed by Beck et al. (2016) for the SDSS Data Release 12. It uses a training set of 2313724 galaxies for which the spectroscopic redshift is obtained from SDSS, and magnitudes and colours are obtained from the Pan-STARRS1 Data Release 2 survey. The photometric redshift of a galaxy is then estimated by means of a local linear regression in a 5-dimensional magnitude and colour space. Our method achieves an average bias of $overline{Delta z_{rm norm}}=-2.01 times 10^{-4}$, a standard deviation of $sigma(Delta z_{rm norm})=0.0298$, and an outlier rate of $P_o=4.32%$ when cross-validating on the training set. Even though the relation between each of the Pan-STARRS1 colours and the spectroscopic redshifts is noisier than for SDSS colours, the results obtained by our method are very close to those yielded by SDSS data. The proposed method has the additional advantage of allowing the estimation of photometric redshifts on a larger portion of the sky ($sim 3/4$ vs $sim 1/3$). The training set and the code implementing this method are publicly available at www.testaddress.com.