Iterative learning control (ILC) aims to maximize the performance of systems performing repeated tracking tasks. However, in most existing applications, the motion profile is inherently specified <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">a priori</i> , which has restricted both its application range and scope of performance improvement. For example, the typical repeated path-following task in robotics only requires a spatial path profile rather than a temporal trajectory profile, for which most existing ILC designs are unsuitable. To handle this requirement, this article extends the ILC task description by relaxing this postulate to enable a trial-varying motion profile and formulate an ILC path-following problem with system constraints. Under this extended problem setup, a spatial ILC algorithm is proposed with efficient implementation and robust convergence analysis, which updates the input signal and motion profile at the end of each trial to reduce the tracking error. This algorithm is implemented experimentally on a gantry robot test platform to verify performance, practical feasibility, and reliability. Comparisons with other control methods are also made to clarify its advantages, such as error reduction, control effort reduction, and constraint handling.