Lars von Trier has suffered from clinical depression. This will not surprise anyone who sees “Melancholia,” his latest film and his first in a while to feature relatable human emotions, with Kirsten Dunst giving a career-best performance as a young woman barely surviving in a fog of depression. Because he is Lars von Trier, he has weirded the story up considerably, putting the woman’s struggle against the backdrop of a newly discovered planet hurtling toward Earth, possibly on a collision course — a rather on-the-nose metaphor for a depressive’s gloomy state of mind, but an effective one.

After an artful and evocative Wagner-scored prologue depicting slow-motion catastrophe, we meet Dunst’s character, Justine, on what should be a joyful occasion: her wedding day. She seems chipper enough when she and her new husband, Michael (Alexander Skarsgard), arrive at the reception being held in their honor at the lavish country manor owned by her sister, Claire (Charlotte Gainsbourg), and Claire’s rich husband, John (Kiefer Sutherland). The girls’ mother, Gaby (Charlotte Rampling), a furious woman who hates marriage, makes icy remarks to their father, Dexter (John Hurt), whom she long ago divorced. Dexter is as twinkly-eyed and vivacious as his ex-wife is cold, and you can see how Justine has inherited aspects of both.

Things gradually fall apart for Justine over the course of the evening as she tries to control a flood of conflicting, often irrational emotions. Michael is aware of her history with depression and is sympathetic, while her parents, sister, and brother-in-law seem unsure. John, remarking on how expensive the elaborate party was for him to host, tells her, “You’d better be G–d— happy.” Justine replies: Yes. I should be. I really should be.

That’s the thing with depression, of course. You feel miserable even when there is no logical reason for it. The second half of the film reinforces this by focusing more on Claire, who’s terrified that the new planet will hit the Earth even though all the scientists have said it won’t. (That includes John, the movie’s voice of logic and reason — and, ultimately, the one least capable of dealing with truly stressful situations.) Claire understands her fears aren’t rational but can’t shake them. Justine, still in a heavy-lidded daze of melancholy, is calm. The end of the world is nothing new for her.

Von Trier gives us several light moments during the wedding reception, even a few laughs here and there. But yes, as you would suppose, the film is mostly a somber affair. Like “Another Earth,” the other 2011 film about a rogue planet, this one is less interested in sci-fi tropes and scientific accuracy than in people’s feelings, and the key actresses’ performances are piercing. Even for an introspective, not-at-all-science-fiction movie, though, “Melancholia” is glacially paced and overlong. There’s giving us time to experience and appreciate the moods of the characters, and there’s dragging things out interminably. Von Trier doesn’t always believe that there is a difference, which is one of the reasons he’s such a maddening director. “Melancholia” is more accessible than “Antichrist” or any of his Dogme projects, but it’s still a challenging piece of work whose rewards only barely justify the effort.

B- (2 hrs., 15 min.; R, some harsh profanity, some nonsexual nudity, brief sexuality.)