Have any spacecraft landed on an asteroid?

Yes, and there are several examples!

On February 12, 2001 flight controllers landed NASA's NEAR spacecraft on an asteroid called Eros. NEAR was the first spacecraft to orbit and touchdown on the surface of an asteroid. NEAR began orbiting Eros a year earlier, on February 14, 2000. The spacecraft collected close up photographs and measured the size and shape of Eros before landing. Eros is the largest of the asteroids whose orbits cross the orbit of the Earth.

NASA's OSIRIS-REx spacecraft traveled to near-Earth asteroid Bennu and is bringing a small sample back to Earth for study. The mission launched Sept. 8, 2016, from Cape Canaveral Air Force Station. The spacecraft reached Bennu in 2018 and will return a sample to Earth in 2023. For more information, visit the NASA OSIRIS-REx website.

Japan's Hayabusa2 spacecraft launched in 2014 on a mission to survey asteroid Ryugu and collect a surface sample for return to Earth. In 2020 the samples were returned to Earth for further study. For more information, visit JAXA's Hayabusa2 website.

While it's primary mission was to study and land on a comet rather than an asteroid, the ESA Rosetta cornerstone mission studied the Jupiter-family comet 67P/Churyumov-Gerasimenko with a combination of remote sensing and in situ measurements. The spacecraft arrived at the comet in August 2014 following a 10-year journey. On November 12, 2014, Rosetta's lander Philae was deployed to the surface. Philae carried a suite of instruments for imaging and sampling the comet nucleus. The mission ended in a controlled landing on the comet's surface on September 30, 2016. For more information visit the ESA Rosetta website.

NASA's Deep Impact mission studied Comet Tempel 1. The spacecraft delivered an impactor into the path of Tempel 1 to reveal never-before-seen materials and provide clues about the internal composition and structure of a comet. On July 4, 2005 the impactor intercepted Tempel 1 revealing that the comet's surface layer is very porous, and that that hyperactive comets are driven by carbon dioxide. For more information, visit NASA's Deep Impact website.