After the Apollo missions, Mattingly become a Space Shuttle astronaut and flew two missions. The first was STS-4, from June 26 to July 4, 1982. This was the fourth and final orbital test flight for the Space Shuttle Columbia and Mattingly was the mission commander. STS-4 did 112 orbits of the Earth. His second mission was STS-51C in January 1985 in the Space Shuttle Discovery. Mattingly was again the mission commander for this short trip which launched equipment for the Department of Defense.