A process for preparing a catalyst for the conversion of oxygenates to olefins in the form of a shaped body, wherein the catalyst comprises one or more zeolites of the MFI structure type and particles of one or more metal oxides, the one or more zeolites of the MFI structure type comprising an alkaline earth metal, and the particles of the one or more metal oxides comprising phosphorus, the phosphorus being present at least partly in oxidic form, where the alkaline earth metal is Mg, where the one or more zeolites of the MFI structure type comprise(s) the one alkaline earth metal in a total amount in the range from 0.1 to 20% by weight, based on the total amount of the one or more zeolites of the MFI structure type and calculated as the metal, where the one or more metal oxides are selected from the group consisting of alumina, titania, zirconia, aluminum-titanium mixed oxides, aluminum-zirconium mixed oxides, aluminum-lanthanum mixed oxides, aluminum-zirconium-lanthanum mixed oxides, titanium-zirconium mixed oxides and mixtures of two or more thereof, and where the shaped body comprises a mixture of the one or more zeolites of the MFI structure type and of the particles of the one or more metal oxides, comprising (i) providing the one or more zeolites of the MFI structure type; (ii) impregnating the one or more zeolites of the MFI structure type with a solution comprising the one alkaline earth metal, preferably by means of spray impregnation; (iii) optionally drying the one or more impregnated zeolites obtained in (ii); (iv) optionally calcining the one or more impregnated zeolites obtained in (ii) or (iii); (v) preparing a mixture comprising the one or more impregnated and optionally dried and/or calcined zeolites of the MFI structure type, one or more solvents and particles of the one or more metal oxides and/or precursor compounds of the one or more particles of the one or more metal oxides; (vi) homogenizing the mixture obtained in (v); (vii) extruding the homogenized mixture obtained in (vi); (viii) optionally drying the extrudate obtained in (vii); (ix) optionally calcining the extrudate obtained in (vii) or (viii); (x) impregnating the optionally dried and/or calcined extrudate with a phosphorus-comprising solution which comprises one or more acids of phosphorus selected from the group consisting of phosphonic acid, phosphoric acid, diphosphonic acid, diphosphoric acid and mixtures of two or more thereof; (xi) optionally drying the impregnated extrudate obtained in (x); (xii) calcining the extrudate obtained in (x) or (xi). (i) providing the one or more zeolites of the MFI structure type; (ii) impregnating the one or more zeolites of the MFI structure type with a solution comprising the one alkaline earth metal, preferably by means of spray impregnation; (iii) optionally drying the one or more impregnated zeolites obtained in (ii); (iv) optionally calcining the one or more impregnated zeolites obtained in (ii) or (iii); (v) preparing a mixture comprising the one or more impregnated and optionally dried and/or calcined zeolites of the MFI structure type, one or more solvents and particles of the one or more metal oxides and/or precursor compounds of the one or more particles of the one or more metal oxides; (vi) homogenizing the mixture obtained in (v); (vii) extruding the homogenized mixture obtained in (vi); (viii) optionally drying the extrudate obtained in (vii); (ix) optionally calcining the extrudate obtained in (vii) or (viii); (x) impregnating the optionally dried and/or calcined extrudate with a phosphorus-comprising solution which comprises one or more acids of phosphorus selected from the group consisting of phosphonic acid, phosphoric acid, diphosphonic acid, diphosphoric acid and mixtures of two or more thereof; (xi) optionally drying the impregnated extrudate obtained in (x); (xii) calcining the extrudate obtained in (x) or (xi).