Measurement of the cosmic ray spectrum above 4 × 1018 eV using inclined events detected with the Pierre Auger Observatory