Depression finally seems to have brought out the best in Lars von Trier: “Melancholia” is his strongest work in a while, a devastatingly beautiful, operatic mixture of all his signature themes andvisual schemes. Doom is certain from the start. This is, after all, a von Trier film. But the director portends his characters’ fate with a lengthy, wordless prelude: a series of sumptuously photographed, super-slowmotion images of sadness and frustration accompanied by the swelling overture from Wagner’s “Tristan und Isolde.” We see Kirsten Dunst and Charlotte Gainsbourg struggle against the elements, against themselves. We know this cannot end well. 

Bombastic? But of
 course. Still, we’re hooked. Yet melacholia isn’t just a state of mind but also the name of a planet that’s hurtling toward Earth. Yes, an actual planet — or a metaphor, you decide. It doesn’t matter; what resonates is the resulting mood, and it’s inescapable.

Von Trier himself has battled depression over the past several years; he last worked through it cinematically,
 and far less effectively, with the gratuitous “Antichrist” from 2009, which featured genital mutilation and the unintentional catchphrase, “Chaos reigns.” This time, the Danish writer-director seems far more interested in exploring the depths of his characters’ despair and fear.

Von Trier has been unjustly accused of misogyny toward his female characters, and yes, they do tend to suffer horribly.

But these roles also provide enticing challenges for the actresses playing them, and in the antisocial, apprehensive bride Justine, Dunst delivers the
 most complex performance of her life. Everything about her carriage suggests that she’s psychologically slogging through molasses just to carry out basic, daily functions like bathing and eating dinner.

Quite often, you want to just hand her a prescription and be done with it.

But Dunst also vividly conveys Justine’s feeble attempts at normalcy and civility with just the slightest forced smile.

The irony is that the closer this threatening planet draws near, the better she feels. If this is the
 end of the world, she welcomes it. “Melancholia” is divided into two parts, beginning with “Justine,” which focuses on her lavish wedding day. It’s a bad omen that the limousine carrying her and her new husband, the sweetly bland Michael (Alexander Skarsgard), repeatedly gets stuck trying to drive up the narrow, winding path to the decadent estate where the reception is taking place.

This also happens to be the home of her sister, Claire (Gainsbourg), and
 her wealthy husband, John (Keifer Sutherland), who become increasingly frustrated with Justine’s inability to act polite and appreciative on cue.

Empty rituals like cutting the wedding cake or tossing the bouquet become torturous waiting games.

But weirdness abounds thanks to several invited guests, including Justine and Claire’s abrasive mother (a deliciously cruel Charlotte Rampling) and Justine’s boss (von Trier regular Stellan Skarsgard), who insists on hounding her about work.

The cumulative train wreck, presented in matter-of-fact and often humorous fashion, is riveting and it builds a steady tension.

Part two, “Claire,” feels less urgent, less unpredictable, but it lulls us into a somber mood in preparation for the film’s climax.

It follows Claire as she tries to care for her sister and raise her young son while keeping the family’s rambling mansion afloat and preparing for the Earth to be swallowed whole.

John is fascinated by the approach of this other, previously unknown planet, which he insists will bypass our own entirely.

Claire, however, grows more paranoid and anxious by the day — and actually does seek out some form of pharmacological relief. As she proved in “Antichrist,” Gainsbourg is willing to go as far as she must in portraying her character’s extremes.