Professor Olaf Blanke, from the Ecole Polytechnique Federale de Lausanne, said: "Our experiment induced the sensation of a foreign presence in the laboratory for the first time.
"It shows that it can arise under normal conditions, simply through conflicting sensory-motor signals. The robotic system mimics the sensations of some patients with mental disorders or of healthy individuals under extreme circumstances.
"This confirms that it is caused by an altered perception of their own bodies in the brain."
To manifest their ghosts, the scientists set up a robot device that enabled volunteers to move a jointed mechanical arm with their index fingers.
The movements were copied by another robot arm behind them, which touched their backs.
When the finger-pushing and back-touching occurred at the same time, it created the illusion that the volunteers were caressing their own backs.
When the back-touching was delayed to become 500 milliseconds out of sync, the volunteers reported feeling as if they were being watched and touched by ghostly presences.
At the same time, they had the sensation of drifting backwards, towards the unseen hand. Several reported a strong feeling of invisible people - two on average - being close by.
Two of the participants were so disturbed by the experience that they asked the scientists to halt theirexperiment.
Dr Giulio Rognini, a co-author of the study, said: "Our brain possesses several representations of our body in space. Under normal conditions, it is able to assemble a unified self-perception of the self from these representations.
"But when the system malfunctions because of disease - or, in this case, a robot - this can sometimes create a second representation of one's own body, which is no longer perceived as me but as someone else, a presence."
The experiment suggested that "feelings of presence", often interpreted as spirits, angels or demons, are in the mind, said the researchers.
They cite the case of Reinhold Messner, a mountaineer, who, descending from a Himalayan peak freezing, exhausted and starved of oxygen, became aware of a third climber "descending with us, keeping a regular distance, a little to my right and a few steps away from me".
Before conducting the experiment, the researchers carried out brain scans of 12 patients with neurological disorders who had encountered "feelings of presence" in the past.
They identified disturbances in three brain regions, all involved in self-awareness, movement, and sense of position in space.
The research was published in the journal Current Biology.