Objective: To determine the associated factors, decompose the socioeconomic inequalities, and analyze the spatial distribution of childhood diarrhea in Peru. Methods: A cross-sectional analytical study was conducted using data from the National Demographic and Family Health Survey 2021. The dependent variable was the presence of diarrhea in the last two weeks. Three types of analysis were performed: (i) to evaluate the associated factors, generalized linear models of the Poisson family with logarithmic link were applied and prevalence ratios with their 95% confidence intervals were reported; (ii) for the analysis of inequalities, a decomposition of the Erreygers concentration index was performed using a generalized linear model; and (ii) a spatial autocorrelation analysis, hot spot analysis and cluster and outlier analysis were performed. Results: A total of 18,871 children under 5 years of age were included. The prevalence of diarrhea in this population was 10.0%. Determinants such as being aged 0–23 months, being male, belonging to the poorest, poorer and rich wealth index, and residing in the Highlands and Jungle increased the probability of presenting diarrhea. In the decomposition analysis, diarrhea had a pro-poor orientation, with the greatest contributors were age 0–23 months, belonging to the poorest and poorer wealth indexes, and residing in the Highlands and Jungle. Spatial analysis showed that the highest concentrations and occurrence of this event were observed in departments of the Highlands and Jungle. Conclusion: Government institutions seeking to reduce the numbers and burden of childhood diarrhea should focus their strategies on promoting hygiene measures and improving access to water and sanitation services, especially in poor populations living in the Peruvian Highlands and Jungle.