Desert ants returning from a foraging trip to their nest navigate both by path integration and by visual landmarks1, 2, 3. In path integration, ants compute their net distance and direction from the nest throughout their outward1 and return4 journeys, and so can always return directly home from their current location1. As the path-integration vector is updated over the entire journey, we call it a global vector. On a familiar route, when ants can steer by visual landmarks, they adopt a fixed and often circuitous path consisting of several separate segments that point in different directions2,3,5. Here we show that, as in honeybees6, 7, 8, such multisegment journeys are composed partly of stored local movement vectors, which are associated with landmarks and are recalled at the appropriate place. We also show that a local vector learnt at one value of the global vector can be recalled at many values, and that expression of the global vector is temporarily inhibited while the local vector is used. These results indicate that the global vector is ignored during navigation through familiar, cluttered territory, but that it re-emerges to take the ant home once the insect leaves the clutter and other guidance strategies cease to operate.