We characterize the surjectivity and the existence of a continuous linear right inverse of the Stieltjes moment mapping on Gelfand-Shilov spaces, both of Beurling and Roumieu type, in terms of their defining weight sequence. As a corollary, we obtain some new results about the Borel-Ritt problem in spaces of ultraholomorphic functions on the upper half-plane.2010 Mathematics Subject Classification. 30E05, 44A60, 46E05. Key words and phrases. The Stieltjes moment problem, Gelfand-Shilov spaces, the Borel-Ritt problem, spaces of ultraholomorphic functions on the upper half-plane, continuous linear right inverses.The author is supported by FWO-Vlaanderen, via the postdoctoral grant 12T0519N.