Specters as good or evil spirits

Angels and ministers of grace defend us!
Be thou a spirit of health or goblin damned,
Bring with thee airs from heaven or blasts from hell,
Be thy intents wicked or charitable,
Thou com'st in such a questionable shape
That I will speak to thee.   (I.iv.39-44.)

        The spirit that I have seen
May be the devil, and the devil hath power
T' assume a pleasing shape; yea, and perhaps,
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me.  (II.ii.610-615)

It is apparent that Hamlet is concerned that the ghost might be a demonic power assuming the shape of his father (or creating that illusion) in order to lead him astray. In the context of the popular belief that almost all visible spirits are manifestations of the devil, such apprehensions seem more than justified. H.D.F. Kitto underlines the consequences of Hamlet's assessment of the apparition.

'The spirit that I have seen may be the Devil: is it a gross exaggeration to say that on this one throw Hamlet has staked not only his temporal but also his eternal welfare?...This is the issue in which Shakespeare has invited his audience to interest itself: nothing less.  - -H.D.F. Kitto, Form and Meaning in Drama, New York, Barnes & Noble, [1959,c1956], p.308.

We are in the presence of evil.  -- p.255.