Porcine epidemic diarrhea virus (PEDV) poses a significant threat to pigs, with piglets under seven days old facing a mortality rate of up to 100 %. This study aimed to explore the maturation of the immune system in piglets across different age groups and their corresponding immune responses to PEDV infection. Real-time quantitative PCR was employed to assess the relative mRNA expression of inflammation-related factors in infected pigs compared to non-infected counterparts at varying ages. Additionally, flow cytometry was utilized to analyze the relative counts of CD4(+) and CD8(+) T cells, as well as CD21(+) B cells, in peripheral blood, spleen, mesenteric lymph nodes, and Peyer's patches of piglets at different developmental stages. Our findings revealed a notable increase in IFN-alpha and IFN-gamma, a decrease in TNF-alpha, and elevated expression of IL-1 beta, IL-6, IL-10, and IL-17 following PEDV infection. Furthermore, the numbers of CD4(+) and CD8(+) T cells, along with CD21(+) B cells, exhibited a gradual rise with the advancement of piglets' age. Overall, our study underscores the progressive enhancement of piglets' resistance to PEDV infection as their immune system matures over time.