Cocaine and crack usage is a major public health concern worldwide, mainly when the target consumers are pregnant women. The purpose of this study was to develop and validate a cost-effective method for identification and quantification of cocaine, benzoylecgonine, cocaethylene, and anhydroecgonine methyl ester in meconium samples, using solid-phase extraction (SPE) and GC/MS (ion trap – full scan mode) to be employed in public hospitals in Brazil. The method was validated in the 20 - 1000 ng/g range for cocaine and cocaethylene, 40 - 1500 ng/g for benzoylecgonine and 60 - 1500 ng/g for anhydroecgonine methyl ester, using 0.5 g meconium per assay. The detector response was linear in the studied range, and the limit of detection was found to be 10 ng/g for cocaine and cocaethylene, 30 ng/g for benzoylecgonine, and 40 ng/g for anhydroecgonine methyl ester. Intra-batch coefficients of variation oscillated between 3.01% and 10.15% and inter-batch coefficients varied between 5.31% and 11.12%; accuracy was in 91.47% - 105.31% range. Recoveries were higher than 56.30%. Finally, the method was applied to meconium analysis from 20 newborns at the Hospital Clínicas da Faculdade de Medicina de Ribeirão Preto, and it identified 6 positive samples.