Limited knowledge is available about the association between autistic spectrum disorder (ASD) and precocious puberty. Our study examined the association between the two medical conditions, and the effect modification by sex and neuropsychiatric comorbidities in a nationwide population. To compare the risk of precocious puberty between ASD and non-ASD cases, we conducted Cox regression analysis, using ASD as exposure and time-to-precocious puberty as outcome. We adjusted for sex, attention-deficit/hyperactivity disorder (ADHD), tics disorder, obsessive–compulsive disorder (OCD), anxiety disorder, intellectual disability, and epilepsy. We performed a moderation analysis to examine the potential moderating effects by sex or comorbidities. Patients with ASD were prone to have precocious puberty, with an adjusted hazard ratio (aHR) of 1.80 (95% CI: 1.61-2.01). For the effect modification, sex, specifically females, moderated the association between ASD and precocious puberty, with relative excess risk due to interaction (RERI) 7.35 (95% CI 4.90-9.80). No significant effect modification was found for any of the comorbidities within the scope of additive effect modification. We found that patients with ASD were prone to precocious puberty, regardless of sex or comorbid neuropsychiatric disorders. Girls with ASD are at particularly higher risk to develop precocious puberty.