The primary motor cortex (M1) consists of a stack of interconnected but distinct layers. However, knowledge of brain-wide circuit function of M1 layer-specific pathways is lacking. Here, we combined layer-specific Cre-driver mice, optogenetics, and fMRI with subsequent electrophysiological recordings to reveal distinct M1 layer-specific networks. All L2/3, L4, L5 and L6 stimulations evoked M1 fMRI responses, while only L5 and L6 evoked robust caudate putamen and ventrolateral thalamic nucleus responses. Subsequent LFP and spike recordings were in line with these fMRI results. Overall, our techniques and results could help investigate brain-wide layer-specific cortical circuit functions in development, aging and diseases.