The little heroine’s name is slightly twisted in “Coraline,” and so is the movie as a whole—but in a good way. Just as you’d expect from Henry Selick, the director of “The Nightmare Before Christmas” (which is often wrongly thought of as being entirely Tim Burton’s work), this is an animated picture that has a message that can benefit kids—in this case, appreciate your parents, however imperfect they might be (or, more generally, be careful what you wish for)—but is in no sense childish. It’s a deliciously macabre adaptation of Neil Gaimon’s book that has the quirky, moody but ultimately sweet tone of “Nightmare.” But its hallucinatory quality also calls to mind the surrealistic short films of the Quay Brothers, though with a notably lighter touch. And even its use of 3D—available in selected theatres, and a highly recommended option—is subtler than the norm.

The plot has Coraline (Dakota Fanning), a convincingly willful girl, obviously unhappy with her mom and dad (Teri Hatcher and John Hodgman), commercial writers who have moved the family into a portion of a remote old house, especially since they pretty much ignore her in their drive to finish their later project, a gardening catalogue. The only other human contact she has is with the oddball characters who live in the other sections of the place—two ditzy old dames, Miss Spink (Jennifer Saunders) and Miss Forcible (Dawn French), who were once vaudeville performers, and a weird circus contortionist, Mr. Bobinsky (Ian McShane), who has a herd of trained mice—along with a friendly but strange local boy named Wybie Lovat (Robert Bailey, Jr.).

Coraline finds solace, though, in a mirror world that she discovers behind a locked, papered-over little door in her room, where she finds alternative, and far nicer, versions of her parents—loving, solicitous, totally devoted to the girl’s needs; the only difference is that they have buttons for eyes. A button-eyed Wybie shows up, too. Of course the girl is drawn to their invitation to abandon her old life and stay with them permanently by agreeing to sew buttons over her eyes. But she’ll find, largely as the result of help from a wise old cat (Keith David), that the offer carries a terrible price. To save herself from it and get back to her real parents, though, she’ll have to bargain with the malevolent “other mother” controlling this dark universe to rescue not just herself but the spirits of other children who, when put in the same position she faces, made the wrong choice.

There are hints of “The Wizard of Oz” here: a girl steps unknowingly into a different world and must work to escape from it, helping others in the process. Yet clearly “Alice in Wonderland” served as an inspiration, too, especially since a cat serves as her guide. But the spirit of Gaimon and Selick is different from Frank Baum’s or Lewis Carroll’s. It has its own peculiar charm, and in the final stretch some genuine scares that might prove too much for very young children. But like its predecessors it shows enormous imagination and a sense of real wonder. With the help of editors Christopher Murrie and Ronald Sanders, Selick keeps the plot moving crisply while collaborating with cinematographer Pete Kozachik, art directors Bo Henry, Tom Proost and Phil Brotherton, stop-motion animators Anthony Scott, Travis Knight, Trey Thomas and Eric Leighton and visual effects supervisor Brian Van’t Hul to fashion images that continually fascinate and, in some instances, literally leap off the screen.

He also entices fine vocal turns from his cast, particularly from Fanning, Hatcher and David but all the other principals as well. And like Burton, he recognizes the value of an evocative score that carries the action, which Bruno Coulais skillfully provides.

Selick has had his stumbles—the live-action/animation hybrid “Monkeybone” was awful. But with “Nightmare,” “James and The Giant Peach” and now this film, he’s proven himself a witty and inventive visual artist with a gleefully sinister edge. “Coraline” is that rarity, an animated film with a true touch of dark poetry. Be sure to stay through the final credits, which close with a final 3-D splurge.