A measurement of differential cross sections for the production of a pair of isolated photons in proton–proton collisions at s=7TeV is presented. The data sample corresponds to an integrated luminosity of 5.0 fb-1 collected with the CMS detector. A data-driven isolation template method is used to extract the prompt diphoton yield. The measured cross section for two isolated photons, with transverse energy above 40 and 25 GeV respectively, in the pseudorapidity range |η|<2.5 , |η|∉[1.44,1.57] and with an angular separation ΔR>0.45 , is 17.2±0.2(stat)±1.9(syst)±0.4(lumi) \,pb . Differential cross sections are measured as a function of the diphoton invariant mass, the diphoton transverse momentum, the azimuthal angle difference between the two photons, and the cosine of the polar angle in the Collins–Soper reference frame of the diphoton system. The results are compared to theoretical predictions at leading, next-to-leading, and next-to-next-to-leading order in quantum chromodynamics.