The microRNA pathway has been implicated in the regulation of synaptic protein synthesis and ultimately in dendritic spine morphogenesis, a phenomenon associated with long-lasting forms of memory. However, the particular microRNAs (miRNAs) involved are largely unknown. Here we identify specific miRNAs that function at synapses to control dendritic spine structure by performing a functional screen. One of the identified miRNAs, miR-138, is highly enriched in the brain, localized within dendrites and negatively regulates the size of dendritic spines in rat hippocampal neurons. miR-138 controls the expression of acyl protein thioesterase 1 (APT1), an enzyme regulating the palmitoylation status of proteins that are known to function at the synapse, including the alpha(13) subunits of G proteins (Galpha(13)). RNA-interference-mediated knockdown of APT1 and the expression of membrane-localized Galpha(13) both suppress spine enlargement caused by inhibition of miR-138, suggesting that APT1-regulated depalmitoylation of Galpha(13) might be an important downstream event of miR-138 function. Our results uncover a previously unknown miRNA-dependent mechanism in neurons and demonstrate a previously unrecognized complexity of miRNA-dependent control of dendritic spine morphogenesis.