The effect of friction stir processing (FSP) on the microstructure and mechanical properties of Mg–4Si composite was investigated. FSP was performed under the traverse speeds of 8, 12.5, and 16 mm min−1 at different rotation speeds of 800, 1250, and 1600 rev min−1. FSP greatly improved the mechanical properties of the composite. The optimum mechanical properties were obtained at the traverse and rotation speeds of 12.5 mm min−1 and 1250 rev min−1, respectively. The tensile strength, fracture strain, and microhardness of the composite were improved by about 140, 512, and 20%, respectively. The effective refinement and even distribution of Mg2Si particles, formation of ultrafine dynamically recrystallized grains, and the elimination of casting defects were the most influential factors affecting the properties of the alloy.