Abstract Effect of microstructural changes after friction stir processing (FSP) on the corrosion behaviour of rare earth containing QE22 magnesium alloy is studied. FSP produced ultrafine-grained α-Mg matrix and refined the Mg 12 Nd precipitates whereas Mg 12 Nd 2 Ag precipitates got dissolved in the matrix. Although its hardness increased from 76 to 90 VHN, the FSPed alloy displayed inferior corrosion resistance in 3.5 wt% NaCl solution. This is attributed mainly to the iron contamination from FSP and presence of refined second phase particles which work as active cathodic sites. The role of distributed Mg 12 Nd precipitates before and after FSP is analysed from micro galvanic corrosion point of view.