The mood throughout Tess of the D'Urbervilles is quite ominous and foreboding, with very little respite for its characters. The novel is characterized by a bleak, almost dingy sadness, showcasing the emotional toll of poverty and gendered exploitation.
The sheer amount of foreshadowing in the novel contributes to this generally ominous mood—for example, leading up to the moment in which Alec rapes Tess, he is seemingly always present in the background, stalking Tess and watching her every move. Note this passage from Chapter 9:
The old lady was not present, and turning round the girl had an impression that the toes of a pair of boots were visible below the fringe of the curtains [. . .]. She searched the curtains every morning after that, but never found anybody within them. Alec D’Urberville had evidently thought better of his freak to terrify her by an ambush of that kind.
Moments like this, combined with moments in which the narrator directly alludes to future tragic events, build a sense of tragic anticipation. Even when Tess is free of Alec, she is never really free of him until she kills him at the end of the novel. Thus, the mood throughout the novel is distinctly haunted by Tess's past traumatic encounter and remains bleak throughout, even in passages of momentary happiness.