Data collected at the Pierre Auger Observatory are used to establish an upper limit on the diffuse flux of tau neutrinos in the cosmic radiation. Earth-skimming ντ may interact in the Earth's crust and produce a τ lepton by means of charged-current interactions. The τ lepton may emerge from the Earth and decay in the atmosphere to produce a nearly horizontal shower with a typical signature, a persistent electromagnetic component even at very large atmospheric depths. The search procedure to select events induced by τ decays against the background of normal showers induced by cosmic rays is described. The method used to compute the exposure for a detector continuously growing with time is detailed. Systematic uncertainties in the exposure from the detector, the analysis, and the involved physics are discussed. No τ neutrino candidates have been found. For neutrinos in the energy range 2 × 10¹⁷ eV < Eν < 2 × 10¹⁹ eV, assuming a diffuse spectrum of the form E⁻²ν, data collected between 1 January 2004 and 30 April 2008 yield a 90% confidence-level upper limit of E²νdNντ / dEν < 9 × 10⁻⁸ GeV cm⁻² s⁻¹ sr⁻¹.