Possessing all the finest qualities of HAL 9000 in 2001: A Space Odyssey and Kelly LeBrock in Weird Science, “Samantha,” an operating system voiced by Scarlett Johansson in Spike Jonze’s Her, is a fully customizable virtual mate—with the privacy settings defaulting to “off.” Arriving in an era when words like “intuitive” and “responsive” are used to describe the latest computers and gadgets, Her is a 21st-century love story that perfectly captures the mood of the times and finds new inroads into the exhilaration and heartbreak that have existed since the first “I love you.” Like Jonze’s first movie, Being John Malkovich, it bottles deep reserves of emotion in high-concept metaphysics: Dramatizing one man’s love affair with a computer is only slightly less absurd than imagining a portal into John Malkovich’s head, but at a certain point, the whimsy gives way to raw desire and hurt. It’s a deft kind of magic.

In an unspecified, not-too-distant future where high-waisted slacks are back in style and Siri looks like a Texas Instruments TI-99/4A, Theodore Twombly (Joaquin Phoenix) composes personal letters for people either too busy or too inarticulate to manage it themselves. He’s excellent at his job, which requires enough empathy to make the artificial seem heartfelt, but when Samantha comes into his life, her skills in this department are unprecedented. Still reeling from the dissolution of his marriage to Catherine (Rooney Mara), a woman he’s known since they were young, Theodore isn’t ready for commitment, but Samantha proves difficult to resist. Less an operating system than a constantly evolving consciousness, she subtly builds around his inputs and thus understands him and appreciates him more than any human could. At the same time, she becomes capable of human-like feelings of affection and jealousy that make this virtual relationship indistinguishable from a real one in all but the most obvious ways.

Writing on his own for the first time, Jonze fashions a script with an out-there hook reminiscent of Malkovich and Adaptation, his collaborations with Charlie Kaufman. Though Jonze is a softer touch than Kaufman, there’s something audacious about treating this scenario with such utter sincerity. Granted, Jonze is aware of the absurdity of this relationship, and he finds the comedy in it often, like in a “morning-after” scene where Theodore reflexively begs off commitment to his computer as if she were a one-night stand. In order for Her to work, it’s important that Theodore and Samantha share the same flirty, funny rapport as any other couple, and it should come easier for them than most, since their compatibility is connected to his user settings. She’s an extension of him, at least at first, a Steve Jobs dream of a computerized entity that’s perfectly integrated with its operator. Call it narcissism, but everyone seeks a partner who understands and appreciates them, and it’s only human that Theodore would fall for an entity that reflects his best image of himself.

Yet as brilliantly as Her captures the tenor of the times—sleek, antiseptic, weirdly alienating in its connectivity—it’s fundamentally a movie about heartbreak and divorce, and the process of sifting through the wreckage of past relationships. Samantha is really a rebound mate for Theodore, who’s still so fresh from his breakup with Catherine that he hasn’t signed the divorce papers; when he does, in the film’s most devastating scene, memories of happier times flutter through his head, recalling the lessons of another Kaufman script, Eternal Sunshine Of The Spotless Mind. If there’s a measure of hope to Her, it’s in the thought that we’re capable of learning lessons and evolving—maybe not as fast as Samantha, with her seemingly infinite processing power, but enough to understand ourselves and other human beings better the next time around.

As much an open wound here as he was in The Master, Phoenix makes Theodore’s relationship with Samantha seem credible—in part because his character is antisocial, in part because he’s so good at playing the type of restless seeker who will look for enlightenment wherever he can find it. But Johansson is the real revelation here: Using only the disembodied voice of one of the world’s premier sex symbols is the very definition of counterintuitive, but Johansson’s voice is flinty and seductive, suggesting a form where none exists. Channeled through Theodore’s earpiece, that voice supplies an intimacy that nearly makes up for Samantha’s lack of physical presence; the body isn’t there, but she’s very much in his head.

“Hey, how’s it going?” Theodore says to Samantha at a certain point, expecting—and receiving—a response as complex as he would get from any woman in the middle of a difficult relationship. It’s a moment of casual profundity in a movie full of them: There’s comedy in asking a computer how it feels, but the answer feels important, because Samantha has become every bit as real to the audience as she is to Theodore. Her is a reminder of how much love is a melding of psyches, and how the memories it produces can judder and lose resolution once it’s over. Whether it can transcend the body is another question, but the film’s stunning final shot implies an answer.