Objective The present study examined how sleep duration and sleep quality are associated with cognitive performance in 8-year-old children using standardized neurocognitive tests. Methods Two hundred ninety children aged 7.4–8.8years participated in the study. Sleep duration and quality were measured using actigraphs and the Sleep Disturbance Scale for Parents. Cognitive performance was measured using four subtests of the Wechsler Intelligence Scale for Children III, the Beery Developmental Test of Visual-Motor Integration (VMI), and the Narrative memory subtest of the Developmental Neuropsychological Assessment for Children. Results When adjusting for age, sex, and maternal education, shorter sleep duration, but not sleep quality, was associated with lower visuospatial abilities (p-values ⩽0.043). Sleep duration and quality were not associated with verbal abilities (p-values⩾0.18). With regard to the individual test results, shorter sleep duration was associated with worse performance in Visual-Motor Integration (p =0.028), and when excluding children with high depression scores the same was also true with Block Design (p-values⩽0.047). Moreover, poor sleep efficiency was associated with worse performance in Similarities (p =0.004). Conclusions In a community sample of 8-year-old children, those who slept less or had poorer sleep quality had lower test scores in cognitive tasks, particularly those pertaining to visuospatial performance, although the association was not very strong.