The transverse energy (ET gamma) spectra of photons isolated from other particles are measured using proton-proton (pp) and lead-lead (PbPb) collisions at the LHC at root s(NN) = 5.02 TeV with integrated luminosities of 27.4 pb(-1) and 404 mu b(-1) for pp and PbPb data, respectively. The results are presented for photons with 25 < E-T(gamma)< 200 GeV in the pseudorapidity range vertical bar eta vertical bar < 1.44, and for different centrality intervals for PbPb collisions. Photon production in PbPb collisions is consistent with that in pp collisions scaled by the number of binary nucleon-nucleon collisions, demonstrating that photons do not interact with the quark-gluon plasma. Therefore, isolated photons can provide information about the initial energy of the associated parton in photon+jet measurements. The results are compared with predictions from the next-to-leading-order jetphox generator for different parton distribution functions (PDFs) and nuclear PDFs (nPDFs). The comparisons can help to constrain the nPDFs global fits.