Hypnosis is an altered state of consciousness resembling sleep. When a hypnotic trance is induced, a subject may be able to recall forgotten events. In some cases, a hypnotized subject may be mentally conditioned to do something against his or her will. It is most often used by doctors and psychiatrists to treat various neurological conditions.
In 2268, First Officer Spock entered a self-induced hypnosis after sustaining a wound from a flintlock rifle on the planet Neural. This was a Vulcan form of self-healing that required great concentration. It wasn't until the last possible moment that a Vulcan would fight their way back to consciousness, which pain helped bring about. (TOS: "A Private Little War")
James T. Kirk believed hypnosis to be a possible reason for Professor John Gill's strange behavior, along with drugs and psychosis. However, he required Doctor Leonard McCoy to determine which. (TOS: "Patterns of Force")
In 2364, Counselor Deanna Troi used hypnosis on both Worf and Doctor Beverly Crusher to determine what had caused a recent memory lapse during which they committed actions which they had no control over. Using the technique, it was found that both officers had been possessed by an unknown entity, which was ultimately revealed to be an energy-based lifeform from the Beta Renner cloud. (TNG: "Lonely Among Us")
Within the holodeck of the USS Voyager, the characters of the holographic Irish village Fair Haven grew suspicious of the Voyager crew in 2376, believing them to be dangerous spirits. Kidnapping Captain Kathryn Janeway and The Doctor, Seamus and the others used hypnosis on The Doctor to learn the truth. Although The Doctor himself was a hologram, he was susceptible to the hypnosis and told the characters the truth about their existence. (VOY: "Spirit Folk")