To investigate the relationship between cognition and prior cannabis use in children and adolescents presenting a first episode of psychosis. A total of 107 patients with first episode of psychosis and 96 healthy controls, aged 9 to 17 years, were interviewed about their previous substance use and to assess their cognitive functions. Patients were assessed while not using cannabis by means of a comprehensive neuropsychological battery. They were divided into 2 groups depending on the history of prior cannabis use: cannabis users (CU) and cannabis nonusers (CNU). Significant differences were found in all areas evaluated between the 3 groups. Both CU and CNU patients obtained lower scores than controls on verbal learning and memory and working memory. Patients with prior cannabis use performed better on some tests of attention (Continuous performance test (CPT) number of correct responses, p = 0.002; CPT average reaction time, p < 0.001) and executive functions (Trail Making Test, part B (TMT-B) number of mistakes, p < 0.001; Wisconsin Card Sorting Test (WCST) number of categories completed, p < 0.001) than CNU patients. CU patients performed better than CNU subjects on some cognitive measures. This may indicate lower individual vulnerability for psychosis in CU patients in whom cannabis use can be a precipitating factor of psychotic episodes.