Because benzene, toluene, ethylbenzene, and xylenes (BTEX) and ethanol are important contaminants present in Brazilian gasoline, it is essential to develop technology that can be used in the bioremediation of gasoline-contaminated aquifers. This paper evaluates the performance of a horizontal-flow anaerobic immobilized biomass (HAIB) reactor fed with water containing gasoline constituents under denitrifying conditions. Two HAIB reactors filled with polyurethane foam matrices (5 mm cubes, 23 kg/m(3) density and 95 % porosity) for biomass attachment were assayed. The reactor fed with synthetic substrate containing protein, carbohydrates, sodium bicarbonate and BTEX solution in ethanol, at an Hydraulic retention time (HRT) of 13.5 h, presented hydrocarbon removal efficiencies of 99 % at the following initial concentrations: benzene 6.7 mg/L, toluene 4.9 mg/L, m-xylene and p-xylene 7.2 mg/L, ethylbenzene 3.7 mg/L, and nitrate 60 mg N/L. The HAIB reactor fed with gasoline-contaminated water at an HRT of 20 h showed hydrocarbon removal efficiencies of 96 % at the following initial concentrations: benzene, 4.9 mg/L; toluene, 7.2 mg/L; m-xylene, 3.7 mg/L; and nitrate 400 mg N/L. Microbiological observations along the length of the HAIB reactor fed with gasoline-contaminated water confirmed that in the first segment of the reactor, denitrifying metabolism predominated, whereas from the first sampling port on, the metabolism observed was predominantly methanogenic.