The perfect 21st-century female looks like a million bucks though costs a great deal more. In “Ex Machina,” Alex Garland’s slyly spooky futuristic shocker about old and new desires, the female in question is a robot called Ava, a name suggestive of both Adam and Eve. Ava has a serene humanoid face and the expressive hands and feet of a dancer, but also the transparent figure of a visible woman anatomy model. Beautiful and smart, sleek and stacked, Ava is at once decidedly unsettling and safely under lock and key, which makes her an ideal posthuman female.

“Ex Machina” is itself a smart, sleek movie about men and the machines they make, but it’s also about men and the women they dream up. That makes it a creation story, except instead of God repurposing a rib, the story here involves a Supreme Being who has built an A.I., using a fortune he’s made from a search engine called Blue Book. Mr. Garland, who wrote and directed, isn’t afraid of throwing around big names or heavy ideas, and he has pointedly named the search engine after Ludwig Wittgenstein’s 1930s “Blue Book.” The trouble with thinking machines, Wittgenstein writes, isn’t that we don’t know yet if they can do the job, but “that the sentence ‘a machine thinks (perceives, wishes)’ seems somehow nonsensical.” And it seems so because such a machine is not (yet) known to us.

“Ex Machina” skips right over that little problem and, like all good science fiction, asserts that the apparently implausible (thinking machines) is absolutely here and now. It makes the imaginative leap, as does Caleb (Domhnall Gleeson), a software grunt who’s won a visit with his employer, the reclusive Blue Book mogul, Nathan (a terrific Oscar Isaac). Shortly after the movie opens, Caleb is being helicoptered to Nathan’s remote compound, a modernist retreat that’s part Zen palace, part patrician man cave, with verdant views, smart-house technology and one curiously mute female employee, a zomboid beauty named Kyoko (Sonoya Mizuno). This isn’t a house, Nathan explains while giving a tour; it’s a research facility in which he’s been working on an artificial intelligence project.

That would be Ava, a conceptual knockout played by the sensational young actress Alicia Vikander. Intricately rendered from her peekaboo belly to the mesh skin that covers much of her visibly artificial parts, Ava looks at once familiar and new, distinctly human and thoroughly machined, evoking by turns the robot in “Metropolis” and a parade of puppet and android vixens. With computer-generated imagery obscuring much of her body, Ms. Vikander builds her controlled performance incrementally, at times geometrically, with angled gestures, head tilts and precision steps. As Ava begins to expresses herself more, making eyes at the exit, Ms. Vikander, who studied ballet, may also remind you of that dancing doll Coppélia, if by way of a “Blade Runner” replicant.

Video

In this scene from Alex Garland’s film, Caleb (Domhnall Gleeson) meets Ava (Alicia Vikander) for the first time.CreditCreditA24

Wowed by Nathan’s attentions or maybe by Ava’s proportions — and presumably by the whole groovy setup that makes the house seem like a docked spaceship — Caleb signs onto Nathan’s endeavors. These at first mostly involve the dudes’ hanging out and Caleb’s chatting with Ava through the thick glass partition that, inexplicably, separates her from the rest of the spread. To explain Caleb’s role, Nathan invokes the Turing test (the imitation game named for its creator, Alan Turing), which hinges on the idea that if a person doesn’t know that he or she is talking to a computer, it makes sense to call the computer intelligent. Except that Caleb, as he points out, knows that he’s talking to a machine. Airily dismissing that nit, Nathan narrows his eyes and asks how Ava makes Caleb feel.

With that appeal to feeling, the movie is off and running. The lab starts to heat up, as does Caleb, who, even as he intellectually spars with Nathan (they’re not remotely in the same weight class), becomes emotionally invested in Ava, friendly chat by chat, shy smile by smile. If, as Wittgenstein also writes, “the human body is the best picture of the human soul” then Caleb’s body when he’s with Ava is an entire Instagram feed of male surrender, from his widening eyes to slackening mouth. Physiognomy is often destiny for actors, and a close-up of Mr. Gleeson’s slender, bobbing throat — stretched across the screen as if offering itself to a knife — nicely suggests why he landed this role.

Image

Oscar Isaac, left, as an Internet mogul and Domhnall Gleeson as his employee.CreditA24

Mr. Garland, a novelist turned screenwriter making his directing debut, sets an eerily, cleverly unsettled stage. The prowling camerawork establishes a sense of absolute control that fits with this strange fishbowl world and is accentuated by copious production design details, including the glass walls and ubiquitous security cameras. He plays with visual contrasts — Mr. Isaac’s compact, muscled body and Mr. Gleeson’s long, drooping one, picture windows that look out onto an expansively lush landscape and windowless rooms that register as upmarket prison cells — that dovetail with the narrative’s multiple, amusingly deployed dualities: confinement and liberation, agency and submission, mind and body. It sounds more serious than it plays because while Mr. Garland wants to tease your brain, he’s an entertainer, and in time ditches science and philosophy for romance and action.

Some of what follows conforms to template, though there’s more here than slick genre moves, including Mr. Isaac and Ms. Vikander, who suggest complexities not on the page. While Nathan’s charisma throws the triangulated drama off balance, “Ex Machina” belongs to Ava, whose depths of meaning enrich the movie and then engulf it. Ava has antecedents in “Pygmalion,” “Metropolis” and elsewhere. Yet even as she transcends the human-machine divide, she defies categorization because of the radical autonomy she shares with the weird sisters inhabited by Scarlett Johansson in “Her,” “Under the Skin” and “Lucy,” and Tatiana Maslany’s clones in the TV show “Orphan Black.” These are the new heroines: totally hot, bracingly cold, powerfully sovereign — and posthuman.