This paper presents a measurement of the double-differential cross section for the Drell-Yan Z/gamma* -> l(+)l(-) and photon-induced gamma gamma -> l(+)l(-) processes where l is an electron or muon. The measurement is performed for invariant masses of the lepton pairs, m(ll), between 116 GeV and 1500 GeV using a sample of 20.3 fb(-1) of pp collisions data at centre-of-mass energy of root s = 8TeV collected by the ATLAS detector at the LHC in 2012. The data are presented double differentially in invariant mass and absolute dilepton rapidity as well as in invariant mass and absolute pseudorapidity separation of the lepton pair. The single-differential cross section as a function of m(ll) is also reported. The electron and muon channel measurements are combined and a total experimental precision of better than 1% is achieved at low m(ll). A comparison to next-to-next-to-leading order perturbative QCD predictions using several recent parton distribution functions and including next-to-leading order electroweak effects indicates the potential of the data to constrain parton distribution functions. In particular, a large impact of the data on the photon PDF is demonstrated.