A model of the low-abundance H II galaxy I Zw 18 is presented in which the electron density decreases with radius, and the central density is high enough to cause partial collisional deexcitation of [O III] λ5007. The model predicts emission-line ratios Fline/FHβ that are in good agreement those observed and simultaneously reproduce the electron temperature Te(O2+) estimated from the ratio Fλ4363/Fλ4959,5007, a problem unsolved by constant-density models. Under such conditions, suppression of λ5007 makes Fλ4363/Fλ4959,5007 an inaccurate estimator of Te(O2+), and hence of oxygen abundance, O/H. The best-fit density-gradient model has log O/H = -4.68, ∼70% higher than the value inferred from the observed line ratios. The best-fit constant-density model, constructed for comparison, fits most line ratios well, but underestimates the strength of Fλ4363 and hence produces a Te(O2+) which is 2500 K too low. Relative to that of oxygen, the nitrogen abundance of both density-gradient and constant-density models is ∼50% higher than in most low-metallity galaxies, while the abundances of carbon, sulphur, and neon are approximately normal. Both models overestimate the strength of He I λ5876 for reasonable helium abundances. The Hα surface brightness - radius relation of the density-gradient model is similar to that of a constant-density model at radii greater than the limit imposed by seeing. The observed surface brightness profile changes with position angle and is somewhat different from the profiles of both models, indicating that the true density distribution of I Zw 18 is more complicated than either a constant or a simple power law with radius. The density-gradient model provides a slightly better fit to the data. I Zw 18 is one of a small class of low-abundance H II galaxies and giant H II regions whose emission-line ratios are not well fitted by a simple Strömgren sphere model; the success of the density-gradient model suggests that it may be possible to explain the properties of this small class of objects in the same way. If so, their abundances are higher than suggested by their observed Fλ4363/Fλ4959,5007. The inclusion of such galaxies would lead to an underestimate of the true slope of the oxygen abundance - helium mass fraction relation, and hence to an overestimate of the primordial helium abundance.