Before you howl in protest at what sounds like an endorsement of sexual harassment, you must understand that the playfully un-P.C. “Secretary” is anything but a slice of grim realism. Shainberg serves it up as a kind of twisted fairy tale–indeed, when Lee first shows up at Grey’s office in her hooded rain slicker, she looks like Little Purple Riding Hood–that’s delicately balanced between the comedic and the erotic. Even the art direction reinforces the fantasy: Grey’s dark, plush office is like something out of a Victorian Gothic novel. Shainberg isn’t interested in the clinical aspects of sadomasochism. Rather, he sees this as a romantic comedy in which two terrified, lost souls find liberation in kink. The comic paradox is that Lee finds empowerment through debasement.

In the wrong hands, the conceit could have turned ugly and offensive. But Spader and Gyllenhaal have a hushed, hilarious chemistry that works like a charm. Spader’s character is like a more disturbed, self-loathing version of the seductive voyeur he played in “sex, lies and videotape.” It’s a dazzling comic portrait of a man both excited and terrified of his own lusts. Gyllenhaal transfixes the camera much as she beguiles her saucer-eyed boss. She’s adorable without going cutesy; she has a starmaking rapport with the audience. We hang on her every mood swing, delighting in her transformation from frumpy duckling to S&M swan. “Secretary” feels fresh and alive when these two share the screen; it’s far less successful when it turns to Lee’s alcoholic father (Stephen McHattie) and overprotective mother (Lesley Ann Warren). Jeremy Davies, as Lee’s other suitor, manages to bring some quirky detail to a fairly thankless role. Shainberg’s heart isn’t in this outer-world stuff–it’s secondhand satire. But behind the heavy doors of Grey’s office, the rhythms slow, the temperature rises and “Secretary” turns everything we thought we knew about romance happily upside down. Sadomasochism may leave you utterly cold, but the movie’s surprising warmth is hard to resist.