Many ant species travel large distances to find food, sometimes covering distances that are up to one million times their body length. Even when these foraging trips follow convoluted paths, the ants usually find their way back to their nest with precision (Wehner et al. in J Exp Biol 199:129-140, 1996). Ants have been shown to use both compass cues in the sky (pattern of polarised light) and landmarks on Earth to return to their nest. We present two experiments conducted on a solitary foraging ant: Melophorus bagoti in their natural habitat in the central Australian desert. Ants were trained and tested in situ. We tested foragers' ability to exit a circular arena which provided an undifferentiated panorama. Artificial visual landmarks were located near a small exit. On tests in which path integration information was not available, foragers did not use artificial landmarks as beacons. Instead, they oriented in the learned exit direction, whether or not it pointed to the nest. We suggest that M. bagoti foragers learned a context-specific local vector when cued by the context of the circular arena. Our findings present the first evidence that M. bagoti foragers learn context-specific compass directions to chart their initial path home.