<b><i>Introduction:</i></b> Serum cotinine and magnesium intake are often associated with childhood asthma. This study evaluated the interaction between serum cotinine and magnesium intake and childhood asthma. <b><i>Methods:</i></b> This cross-sectional study included 14,159 subjects from the National Health and Nutrition Examination Survey 2005–2018. Serum cotinine levels were classified according to the lower quartile: ≤0.2089 ng/mL as low level and >0.2089 ng/mL as high level. Magnesium intake was categorized as high (>98 mg/1,000 kcal) or low level (≤98 mg/1,000 kcal) based on the upper quartile. Weighted logistic regression analyses were adopted to analyze the association between cotinine, magnesium intake, and childhood asthma. Additionally, the combined effect of cotinine and magnesium intake on childhood asthma risk was examined. The stratified analyses were based on gender, body mass index, and family history of asthma to further examine the relationship between cotinine, magnesium intake, and childhood asthma. <b><i>Results:</i></b> The prevalence of asthma was approximately 17.56%. Compared to low-level cotinine, high-level cotinine was associated with asthma (odds ratio [OR] = 1.25, 95% confidence interval (CI): 1.04–1.50). Low-level magnesium intake was related to asthma compared with high-level magnesium intake (OR = 1.21, 95% CI: 1.04–1.40). Using interaction analysis, we also found that the combined effect of cotinine and magnesium intake was associated with childhood asthma risk, and the interaction between high-level cotinine and low-level magnesium intake was associated with the highest risk of childhood asthma (OR = 1.35, 95% CI: 1.04–1.74). Additionally, this interaction was also found in males, overweight/non-overweight, and those with family history of asthma. <b><i>Conclusion:</i></b> There was an interaction between serum cotinine and magnesium intake on childhood asthma. The results suggested that implementing smoking bans in certain settings (e.g., communities, schools) and promoting the consumption of magnesium-rich foods may be effective strategies for preventing childhood asthma.