Todd Haynes’ “Far From Heaven” is a small miracle of a film, a pitch-perfect homage to American films of the fifties that becomes genuinely moving in its own right. Nothing in the writer-director’s previous work–a succession of interesting failures that includes “Poison,” “Safe” and “Velvet Goldmine”–suggested that he was capable of such a perfect fusion of style and content. “Far From Heaven” may have originated as a stunt, but it’s one that transcends its roots and becomes a real work of art. It’s an entrancing and captivating film, easily one of the year’s best.

Haynes’ picture is, first of all, a tribute to the glossy, female-centered domestic dramas that Douglas Sirk specialized in–particularly “All That Heaven Allows,” with which it shares many narrative elements, principally the heroine’s dalliance with a handsome gardener–but as the small-town theatre marquee that appears periodically reminds us, thematically it refers back to other pictures of the period, too (the title of “Hilda Crane” shown at one point reinforces the plot strand involving behavior that leads to local gossip and ostracism). And in making the chaste romance in which the protagonist indulges an interracial one and further raising–in the same muted fashion reminiscent of “Tea and Sympathy”–the issue of dreaded homosexual inclinations (in this context still “the love that dare not speak its name”), it also calls to mind the socially conscious films of the same period (and the early sixties). But that’s still not all: in its depiction of the corporate culture of the time, the script touches on the kinds of issues familiar from such films as “Patterns” and “Executive Suite.” One might expect that Haynes’ picture would have to scramble to draw all these threads together into a convincing whole, but in fact it manages to integrate them seamlessly.

It also captures flawlessly the style of its models. The plush cinematography of Edward Lachman revels in the brilliant autumn colors and swooning camera movements and crane shots so typical of Haynes’ exemplars, and the entire physical production–comprising Mark Friedberg’s production design, Peter Rogness’ art direction, Ellen Christiansen’s set decoration and Sandy Powell’s costume design–is meticulous, lovely and often even witty. To top everything off, that old master Elmer Bernstein contributes a score that’s perfectly judged and absolutely beautiful–as enchanting in its way as his classic music for “To Kill a Mockingbird.”

All of this dexterity would mean little, of course, if “Far from Heaven” remained nothing more than a curio–a technically impressive but emotionally empty relic. But it doesn’t; instead it actually reminds us how powerful and compelling those fifties movies were (and, if viewed without a cynical attitude, still are) even with their obvious contrivances. A good deal of the reason lies in Haynes’ skill, but much is also attributable to the fine cast he’s assembled. Julianne Moore has previously done excellent work in challenging roles, but she outdoes herself here, creating in Cathy Whitaker (dead-on name) a Loretta Young housewife who leaves the stereotype behind and becomes a figure with whom a viewer can honestly empathize; and as the quiet, somber black man whose kindness draws her toward him in her troubles, Dennis Haysbert paints a portrait of wounded dignity and submerged sadness every bit as moving as those that Brock Peters and the young Sidney Poitier used to etch. More surprising, perhaps, is the depth and richness that Dennis Quaid brings to Frank, Cathy’s insecure, sexually troubled businessman-husband. He’s never been this good before. And Patricia Clarkson couldn’t be better as Cathy’s best-friend neighbor, whose support proves insufficient to survive the ultimate plot revelations. Lesser roles, too, are memorably filled.

As movies demonstrate all too often, however, the finest actors in the world will be stranded when confronted by bad writing and sloppy direction. That’s why ultimately the triumph of “Far from Heaven” has to be credited primarily to Haynes. Even if you’ve found his previous films heavy going, don’t rob yourself of the pleasure of this one. Just be willing to go along with the initial conceit and you’ll discover that it’s not merely a beautifully-crafted cinematic trick; it’s quite simply an elegant and astonishingly eloquent film.