Early in life and particularly around weaning, piglets are susceptible to infections because of abrupt social, environmental, and dietary changes. Dietary interventions with probiotic bacteria have gained popularity because of the increased awareness of the direct link between diet and health. In this study, piglets received the probiotic strain Escherichia coli Nissle 1917 (EcN) or a control treatment perorally from day 2 after birth until 2 weeks post-weaning. To investigate spatio-temporal effects of EcN on the gut microbiota composition, intestinal epithelial gene expression and immune system, feces, digesta, blood, scraping material and mesenteric lymph node tissue were collected at different time points. In addition, oral vaccinations against Salmonella enterica serovar Typhimurium were administered on days 21 and 45 of the study to assess the immunocompetence. EcN-treated pigs showed a reduced diversity of taxa within the phylum Proteobacteria and a lower relative abundance of taxa within the genus Treponema during the pre-weaning period. Moreover, EcN induced T cell proliferation and Natural Killer cell activation in blood and enhanced IL-10 production in ex vivo stimulated mesenteric lymph node cells, the latter pointing toward a more regulatory or anti-inflammatory state of the local gut-associated immune system. These outcomes were primarily observed pre-weaning. No significant differences were observed between the treatment groups with regards to body weight, epithelial gene expression, and immune response upon vaccination. Differences observed during the post-weaning period between the treatment groups were modest. Overall, this study demonstrates that the pre-weaning period offers a ‘window of opportunity’ to modulate the porcine gut microbiota and immune system through dietary interventions such as EcN supplementation.