Sharply delineated domains of cell types arise in developing tissues under instruction of inductive signal (morphogen) gradients, which specify distinct cell fates at different signal levels. The translation of a morphogen gradient into discrete spatial domains relies on precise signal responses at stable cell positions. However, cells in developing tissues undergoing morphogenesis and proliferation often experience complex movements, which may affect their morphogen exposure, specification, and positioning. How is a clear pattern achieved with cells moving around? Using in toto imaging of the zebrafish neural tube, we analyzed specification patterns and movement trajectories of neural progenitors. We found that specified progenitors of different fates are spatially mixed following heterogeneous Sonic Hedgehog signaling responses. Cell sorting then rearranges them into sharply bordered domains. Ectopically induced motor neuron progenitors also robustly sort to correct locations. Our results reveal that cell sorting acts to correct imprecision of spatial patterning by noisy inductive signals.