Infections caused by intracellular bacterial pathogens are difficult to treat since most antibiotics have low cell permeability and undergo rapid degradation within cells. The rapid development and dissemination of antimicrobial–resistant strains have exacerbated this dilemma. With the increasing knowledge of host–pathogen interactions, especially bacterial strategies for survival and proliferation within host cells, host-directed therapy (HDT) has attracted increased interest and has emerged as a promising anti-infection method for treating intracellular infection. Herein, we applied a cell-based screening approach to a US Food and Drug Administration (FDA)-approved drug library to identify compounds that can inhibit the intracellular replication of Salmonella Typhimurium (S. Typhimurium). This screening allowed us to identify the antidiarrheal agent loperamide (LPD) as a potent inhibitor of S. Typhimurium intracellular proliferation. LPD treatment of infected cells markedly promoted the host autophagic response and lysosomal activity. A mechanistic study revealed that the increase in host autophagy and elimination of intracellular bacteria were dependent on the high expression of glycoprotein nonmetastatic melanoma protein B (GPNMB) induced by LPD. In addition, LPD treatment effectively protected against S. Typhimurium infection in Galleria mellonella and mouse models. Thus, our study suggested that LPD may be useful for the treatment of diseases caused by intracellular bacterial pathogens. Moreover, LPD may serve as a promising lead compound for the development of anti-infection drugs based on the HDT strategy.