The generation of tissue-resident memory T cells (TRM) is an essential aspect of immunity at mucosal surfaces, and it has been suggested that preferential generation of TRM is one of the principal advantages of mucosally administered vaccines. We have previously shown that antigen-specific, IL-17-producing CD4+ T cells can provide capsular antibody-independent protection against nasal carriage of Streptococcus pneumoniae; but whether pneumococcus-responsive TRM are localized within the nasal mucosa and are sufficient for protection from carriage has not been determined. Here, we show that intranasal administration of live or killed pneumococci to mice generates pneumococcus-responsive IL-17A-producing CD4+ mucosal TRM. Furthermore, we show that these cells are sufficient to mediate long-lived, neutrophil-dependent protection against subsequent pneumococcal nasal challenge. Unexpectedly, and in contrast with the prevailing paradigm, we found that parenteral administration of killed pneumococci also generates protective IL-17A+CD4+ TRM in the nasal mucosa. These results demonstrate a critical and sufficient role of TRM in prevention of pneumococcal colonization, and further that these cells can be generated by parenteral immunization. Our findings therefore have important implications regarding the generation of immune protection at mucosal surfaces by vaccination.