The ghost refers to the "dying embers" of the fire which is just about to go out. In the lines before, the speaker mentions that it is "bleak December", and we can imply it was cold. It is also late at night because the poem begins with "Once upon a midnight dreary". In addition, the speaker was almost asleep because he says "while I nodded, nearly napping. . ." The implication of those lines suggests that the speaker had built a fire earlier that evening and he had begun to read "many a quaint and curious volume for forgotten lore". He had almost dozed off. The fire was going out and each ember left its "ghost" or remains on the floor of the fireplace when suddenly, the speaker hears the tapping of the raven. The language of the poem intensifies the eerie mood and strange occurrences in the poem.
"And each separate dying ember wrought its ghost upon the floor."
This metaphor is the same idea as the idiom "giving up the ghost." The death of the embers is like a person dying and the spirit, or ghost, remaining. In this poem by Poe, the narrator is at home in a cozy room with a fire. He is dozing and realizes the fire is dying down and the sparks, or embers, are going out on the floor. This metaphor is giving the reader a sense of the setting for the poem. To set the mood, Poe uses mysterious and depressing words in these descriptions: “bleak,” “dying,” and “ghost.” We can imagine the cold December night and the narrator sitting by a warm fire, lightly sleeping. The narrator goes on to tell us he has been reading and wishing for daylight. He is trying to find peace from his memories of Lenore:
"Eagerly I wished the morrow;—vainly I had sought to borrow
From my books surcease of sorrow—sorrow for the lost Lenore"