Interaction with host immunoreceptors during microbial infection directly impacts the magnitude of the ensuing innate immune response. How these signals affect the quality of the adaptive T-cell response remains poorly understood. Utilizing an engineered strain of the intracellular pathogen Listeria monocytogenes that infects cells but fails to escape from the phagosome, we demonstrate the induction of long-lived memory T cells that are capable of secondary expansion and effector function but are incapable of providing protective immunity. We demonstrate that microbial invasion of the cytosol is required for dendritic cell activation and integration of CD40 signaling, ultimately determining the ability of the elicited CD8+-T-cell pool to protect against lethal wild-type L. monocytogenes challenge. These results reveal a crucial role for phagosomal escape, not for delivery of antigen to the class I major histocompatibility complex pathway but for establishing the appropriate cellular context during CD8+-T-cell priming.