The capacity for groups to exhibit collective intelligence is an often-cited advantage of group living. Previous studies have shown that social organisms frequently benefit from pooling imperfect individual estimates. However, in principle, collective intelligence may also emerge from interactions between individuals, rather than from the enhancement of personal estimates. Here, we reveal that this emergent problem solving is the predominant mechanism by which a mobile animal group responds to complex environmental gradients. Robust collective sensing arises at the group level from individuals modulating their speed in response to local, scalar, measurements of light and through social interaction with others. This distributed sensing requires only rudimentary cognition and thus could be widespread across biological taxa, in addition to being appropriate and cost-effective for robotic agents.