August Strindberg wrote The Ghost Sonata late in his life, after he had experienced a great deal of success, as well as a great deal of loss. In his later years, having suffered a great deal of loss, struggling with alcoholism and mental illness, Strindberg turned towards mystic spirituality as a source of inspiration, and began writing unusual and expressionistic plays.
In this period of his life, Strindberg referred to an unseeable force that controlled his actions, which he referred to as the "Powers." In 1902, he wrote A Dream Play, through which he sought to theatricalize the workings of the unconscious, blurring the lines between characters, between reality and fantasy, and between waking and dreaming life. By 1907, he opened the Intimate Theatre, where he produced chamber plays, with the support of director Max Reinhardt. His chamber plays included Thunder in the Air, The Burned Site, The Ghost Sonata, and The Pelican. Each sought to dramatize metaphorical states of being, making a spectacle of human interiority. Of these, The Ghost Sonata has become the most influential and well-known.
The Ghost Sonata dramatized a struggle against the repressive forces of the traditional family and the larger vampiric and exploitative class relations in society, and is seen as a precursor to Expressionism, a movement popular in Europe that prized the depiction of emotional states over external reality. Many great directors have counted the play as one of their favorites, including the Swedish auteur Ingmar Bergman, who directed the play four times throughout his career.