To investigate potential risk factors associated with Helicobacter pylori (Hp) infection, we performed a case-control study in 167 consecutively selected hospitalized children in Salvador, Brazil. Hp infection was identified by the presence of IgG against Hp in serum samples. Data were gathered using a structured questionnaire, 38·3% children were found to be seropositive and classified as cases, and 61·7% were seronegative controls. After multivariate analysis, independent variables associated with Hp infection included: the educational attainment of the child's provider [ges ]11 years (OR 0·1, 95% CI 0·01–0·9), poor garbage disposal service (OR 2·2, 95% CI 1·0–4·9), thumb sucking (OR 4·6, 95% CI 1·1–19·8), brushing teeth more than once a day (OR 5·6, 95% CI 1·8–17·7), having a pet dog (OR 2·5, 95% CI 1·0–6·1), and a history of chronic urticaria (OR 4·0, 95% CI 1·5–10·8). The risk factors identified are consistent with some, but not all, previous studies supporting either oral–oral or faecal–oral transmission of Hp. Our data suggested that a higher educational attainment might play an important role in preventing Hp infection.