Transcranial magnetic stimulation (TMS) is a treatment technique that uses a magnetic field to influence brain activity. It can treat depression, obsessive-compulsive disorder and other brain-related conditions. It's noninvasive and can help when other treatment approaches aren't effective.