The computations performed by local neural populations, such as a cortical layer, are typically inferred from anatomical connectivity and observations of neural activity. Here we describe a method-influence mapping-that uses single-neuron perturbations to directly measure how cortical neurons reshape sensory representations. In layer 2/3 of the primary visual cortex (V1), we use two-photon optogenetics to trigger action potentials in a targeted neuron and calcium imaging to measure the effect on spiking in neighbouring neurons in awake mice viewing visual stimuli. Excitatory neurons on average suppressed other neurons and had a centre-surround influence profile over anatomical space. A neuron's influence on its neighbour depended on their similarity in activity. Notably, neurons suppressed activity in similarly tuned neurons more than in dissimilarly tuned neurons. In addition, photostimulation reduced the population response, specifically to the targeted neuron's preferred stimulus, by around 2%. Therefore, V1 layer 2/3 performed feature competition, in which a like-suppresses-like motif reduces redundancy in population activity and may assist with inference of the features that underlie sensory input. We anticipate that influence mapping can be extended to investigate computations in other neural populations.