Traditionally, mapping the motor cortex requires electrodes to stimulate the brain and define motor output pathways. Although effective, electrode-based methods are labor-intensive, potentially damaging to the cortex and can have off-target effects. As an alternative method of motor mapping, we photostimulated transgenic mice expressing the light-sensitive ion channel channelrhodopsin-2 in predominantly layer-5 output cortical neurons. We report that optical stimulation of these neurons in vivo using a stage scanning laser system resulted in muscle excitation within 10-20 ms, which can be recorded using implanted electromyogram electrodes or by a noninvasive motion sensor. This approach allowed us to make highly reproducible automated maps of the mouse forelimb and hindlimb motor cortex much faster than with previous methods. We anticipate that the approach will facilitate the study of changes in the location and properties of motor maps after skilled training or damage to the nervous system.