This cross-sectional study enrolled 97 inpatients at a teaching hospital in Salvador, Bahia, Brazil, to determine breastfeeding prevalence in infants less than 4 months of age hospitalized due to respiratory infection, and to evaluate the impact of hospitalization on breastfeeding. Patients' mothers were interviewed, and a standardized questionnaire was completed. After hospital discharge, medical records were reviewed and information on the infant's feeding practices during hospitalization was recorded. Exclusive breastfeeding was observed in 57.1% of patients, but it was interrupted in 35.4%, with the introduction of infant formula during hospitalization. Mean duration was not associated with the introduction of complementary feeding in the hospital. In the bivariate analysis, early interruption of exclusive breastfeeding was associated with higher maternal schooling and lower family income. Prevalence of exclusive breastfeeding was low. Hospitalization contributed to early interruption of exclusive breastfeeding in 35.4% of infants, possibly due to inadequate hospital infrastructure and insufficient support from health professionals to maintain exclusive breastfeeding.