Spatial qudits are 𝐷-dimensional (𝐷≥2) quantum systems carrying information encoded in the discretized transverse momentum and position of single photons. We present a proof-of-principle demonstration of a method for preparing arbitrary pure states of such systems by using a single phase-only spatial light modulator (SLM). The method relies on the encoding of the complex transmission function corresponding to a given spatial qudit state onto a preset diffraction order of a phase-only grating function addressed at the SLM. Fidelities of preparation above 94% were obtained with this method, which is simpler, less costly, and more efficient than those that require two SLMs for the same purpose.