Magnetic-resonance imaging (MRI) is a non-invasive method to generate three-dimensional images which have a high information content and is used in various fields, ranging from human medicine to material science. In microimaging, the spatial resolution of MRI can approach one micrometer in favorable systems.[1] Magnetic-resonance force microscopy (MRFM) [2][3][4] has opened an avenue for extending imaging to the nanometer range. Two-dimensional images mapping the spin density with 90 nm resolution have recently been obtained [5] and single-spin resolution, as reported for electrons, [6] can be envisioned. As with MRI, the MRFM method is not limited to the three spatial dimensions. Spectroscopic dimensions can be added, providing detailed chemical and structural information at the atomic level. Such experiments are routinely performed in clinical MRI and are denoted as MR spectroscopic imaging (MRSI) or chemical-shift imaging (CSI). [7] Spectral information, for example, from dipolar and quadrupolar interactions, has been used in MRFM experiments, in particular for generating new image contrast. [8][9][10] The most important interaction-the chemical shift-however, has not been employed in MRFM, because of the difficulty of combining high spatial with high spectral resolution. Mechanical detection of chemical shifts, without spatial resolution, has been demonstrated on millimeter-sized samples [11,12] with a setup where the field gradient vanishes at the sample position.MRFM provides an image of the objects spin density by using the spatial variation of the resonance frequency in a magnetic field gradient, in full analogy to MRI. In contrast to MRI, the magnetization is detected mechanically with a micromechanical cantilever that measures the force on the spin magnetic moment in a magnetic field gradient. Spatial resolution and detection sensitivity can be significantly improved over inductively detected MRI, [13] but the permanent presence of a gradient complicates spectroscopy. This problem is particularly true for chemical-shift spectroscopy, because the interaction has the same symmetry properties as the interaction with the magnetic field (gradient). In principle, it is conceivable to extract chemical-shift information in a gradient by recording zero-quantum spectra. [14] Other, related methods have also been discussed; [15,16] all of them, however, have limitations and the full information content of a regular NMR spectrum is not reproduced.An alternative approach, presented herein, is to temporarily move away the gradient source during the experiment (see Figure 1). The spectroscopic information can then be collected in a nearly homogeneous field. We shall demonstrate below that this method allows for chemical-shift imaging.