This paper presents a measurement of the W boson production cross section and the W+/W− cross-section ratio, both in association with jets, in proton-proton collisions at s=8 TeV with the ATLAS experiment at the Large Hadron Collider. The measurement is performed in final states containing one electron and missing transverse momentum using data corresponding to an integrated luminosity of 20.2 fb−1. Differential cross sections for events with at least one or two jets are presented for a range of observables, including jet transverse momenta and rapidities, the scalar sum of transverse momenta of the visible particles and the missing transverse momentum in the event, and the transverse momentum of the W boson. For a subset of the observables, the differential cross sections of positively and negatively charged W bosons are measured separately. In the cross-section ratio of W+/W− the dominant systematic uncertainties cancel out, improving the measurement precision by up to a factor of nine. The observables and ratios selected for this paper provide valuable input for the up quark, down quark, and gluon parton distribution functions of the proton.[Figure not available: see fulltext.].