Previous studies have demonstrated the cortical mechanisms for the gradient of spatial attention in vision and audition, whereas those for touch have yet to be elucidated in detail. In order to examine the within-hand gradient of tactile spatial attention in the cerebral cortex, we used magnetoencephalography (MEG) to record cortical responses to an electrocutaneous stimulation presented randomly to any of the five fingers of the right hand at a random interstimulus interval (750–1250 ms). Participants attended to the index finger, ring finger, or both to detect a rare target stimulus in a sequence of frequent standard stimuli presented to the attended finger(s) by silent counting. Neuromagnetic responses around the contralateral primary and secondary somatosensory cortices (SIc and SIIc) at 50–70 ms and 80–100 ms, respectively, for the stimulation of the index or ring finger were stronger when that finger was attended than when the distant finger was attended or at rest. The amplitude of the SIIc response was also intermediate when the index and ring fingers were simultaneously attended. The SIIc response to the task-irrelevant stimulation of the thumb or little finger increased when the index or ring finger was attended, respectively, suggesting an across-finger gradient of tactile attention. Simultaneous attention to the index and ring fingers decreased the SIIc response to the task-irrelevant stimulation of the intervening middle finger more than that with attention to either one of the two fingers. The earliest attentional sign was observed for the SI M40c response, with the amplitude increasing with the stimulation of the unattended finger. Furthermore, late responses in the temporo-parietal junction (TPJ) and prefrontal cortex (PFC) were stronger with the stimulation of the unattended finger than with that of the attended finger. Thus, the present study provides cortical evidence for the adaptive control of the within-hand, across-finger gradient of tactile attention that depends on whether attention is focused on a single finger or divided into non-adjacent different fingers.