Gothic literature usually involves two broad ideas: 1) the sense that the past always lingers in the present, haunting the living emotionally, psychologically, and sometimes even physically (usually in the form of ghosts); and 2) evoking dread and terror, sometimes even a sense of the supernatural. The Scarlet Letter is not an outright Gothic novel, but it does contain enough traits to give it a Gothic flavor.
Firstly, the main character, Hester, is haunted by the past, specifically her adulterous union with Dimmesdale which results in her pregnancy and social ostracizing. The scarlet letter on her breast is a constant reminder of her past indiscretion, a literal sign that the past is never past. The seventeenth-century setting could also be read as Gothic, since in the nineteenth century, this would have been seen as a rather distant past.
Secondly, there is a sense of the supernatural present in some of the characters. While no literal ghosts or ghouls appear, Hawthorne presents characters like Mistress Hibbins, Roger Chillingworth, and Pearl as having strange connections to the supernatural, as well as possessing some level of otherworldly menace. Mistress Hibbins is a witch who attempts to tempt the lonely Hester to her coven. Chillingworth seems animated by a demonic energy, a desire to revenge himself upon Hester and Dimmesdale. When Dimmesdale repents, Hawthorne explicitly says Chillingworth is now deflated because his evil purpose is done; "there was no more Devil's work on earth for him to do." Demons and even Satan were a staple of classic Gothic literature, such as The Monk, where the main character is tempted and ultimately damned. In The Scarlet Letter, both Hibbins and Chillingworth provide this thematic link.
Pearl is less sinister, but her wild behavior and close connection with nature give her characterization a pagan bent that does not go unnoticed by the other characters. She is often described as an "elf child" or "demon offspring" and displays a startling inquisitiveness which makes her seem much older. She openly torments Dimmesdale until he at last acknowledges her as his child publicly. Even the other Puritans seem disturbed by Pearl, thinking she might be of the Devil due to her intensity and eccentricities. Once Dimmesdale repents, however, the reader is told that Pearl ultimately grows up and achieves a conventional life as a married woman. The change almost suggests a spell has been broken now that both Pearl's parents have atoned.