Using the XMM-Newton observatory, we performed X-ray surveys of the Magellanic Clouds, the two star-forming galaxies nearest to the Milky Way. The images obtained from the EPIC instruments provide a wealth of information about the X-ray source populations in the Small and Large Magellanic Cloud. Due to their proximity we can resolve the emission from supernova remnants, and we have discovered many new X-ray binaries powered by accretion of matter. In particular the Small Magellanic Cloud is remarkable with respect to its large number of X-ray binaries with a high-mass donor star. These discrete sources are embedded in diffuse X-ray emission which originates in the hot phase of the interstellar medium of the clouds.