“The world is not a wish-granting factory.” That line, from “The Fault in Our Stars,” is undoubtedly true, and it is also true that the movie, like the book before it, is an expertly built machine for the mass production of tears. Directed by Josh Boone (“Stuck in Love”) with scrupulous respect for John Green’s best-selling young-adult novel, the film sets out to make you weep — not just sniffle or choke up a little, but sob until your nose runs and your face turns blotchy. It succeeds.

But then again, a brief survey of the story and its themes might make you wonder how it could possibly fail. The main character — whose voice-over narration, drawn verbatim from Mr. Green’s pages, frames the story — is Hazel Grace Lancaster, a teenager who has lived most of her life with the metastatic thyroid cancer she expects will end it very soon. She falls in love with Augustus Waters (Ansel Elgort), known as Gus, a fellow “cancer kid” who has lost part of his leg to the disease but who has been healthy since then and is determined to lead “an extraordinary life.”

As played by Shailene Woodley, a gifted actress grabbing hold of her moment with both hands, Hazel is witty, compassionate and as lovely as a day in June. Her plucky rejection of the usual “cancer story” sentiments becomes a potent form of sentimentality in its own right, and her brave refusal of self-pity ensures the audience’s infinite sympathy. “The only thing that bites worse than having cancer is having a kid with cancer,” she says, and her compassion is borne out by the stricken faces of her parents (Sam Trammell and Laura Dern, both excellent in thinly sketched roles).

Ms. Woodley plays nearly every scene with a plastic oxygen tube anchored to her nostrils and splayed across her face (Hazel’s cancer affects her lungs), but her un-self-conscious performance is the perfect mirror of her character’s pragmatic temperament. Because she never asks for our approval, we are entirely in her thrall. Gus, meanwhile, is such a handsome bundle of chivalry, positive energy and impish self-deprecation that we may swoon over him even before Hazel does. With an unlighted cigarette wedged into his crooked, cocky grin, he is a perfect romantic hero, complete with a semigoofy sidekick (Nat Wolff).

But what can you say about a girl who ... ? The question is not meant to be a spoiler, but rather a point of reference. A long time ago, a movie called “Love Story,” also based on a best seller with terminal illness in its plot, swept through the popular culture and landed its female lead on the cover of Time. The film was potent and memorable without being all that good. And yet it is still possible, all these years later, to laugh at the stilted dialogue and awkwardly staged scenes and find yourself wet-eyed and raspy-voiced at the end.

Image

Ansel Elgort and Shailene Woodley in "The Fault in Our Stars."CreditJames Bridges/20th Century Fox

However it might look in 40 years, “The Fault in Our Stars” seems at first glance like a much better picture, thanks to Ms. Woodley’s discipline and to a script by Scott Neustadter and Michael H. Weber that takes an unhurried, amiable approach to the story. Their earlier screenplays, “500 Days of Summer” and “The Spectacular Now” (also starring Ms. Woodley), were offbeat variations on sturdy romantic-comedy themes, and here they smartly emphasize the dry, idiosyncratic notes in Mr. Green’s sometimes pushy prose.

I’m about to venture onto dangerous ground. Mr. Green’s book is beloved, the emotional power of Mr. Boone’s movie is undeniable, and the real-world experiences behind both are so terrible and complicated that mild skepticism can look like gross insensitivity. Part of the ingenuity of “The Fault in Our Stars” is the way it short-circuits any potential criticism through a combination of winsome modesty and brazen manipulation. These kids are so nice, so wise, so good-humored, and they also may be dying. What kind of a monster could look at them and find fault?

One answer is supplied within the film itself, in the person of Peter Van Houten, a writer whose novel — a cancer story called “An Imperial Affliction” — is a particular obsession of Hazel’s. She shares it with Gus, and the two travel to Amsterdam to find the reclusive author, played with fine, unshaven, whiskey-soaked misanthropy by Willem Dafoe. Van Houten impatiently lectures his visitors on the differences between fiction and reality, but his theoretical points strike them, and are meant to strike us, as both untrue and unkind.

The quarrel between the novelist and his fans, the only real conflict in the film other than the one with disease, is essentially a battle between argument and feeling. It’s hardly a fair fight, and the way it is rigged — fresh-faced, innocent, possibly dying young people facing off against a cynical, broken-down, alcoholic old wreck — provides a clue to the emotional logic of “The Fault in Our Stars.” It’s less a movie about cancer than a depiction — really a celebration — of adolescent narcissism.

Though it is a tragic love story, it is also a perfect and irresistible fantasy. Hazel and Gus possess an absolute moral authority, an ability to assert the truth of their experience that few can share and many might covet. They know the meaning of their own lives, and try as it might, the movie can’t help but give cancer credit for this state of perfection. There is something disturbing about that, and also, therefore, about the source of some of the tears the movie calls forth. The loudest weeping you hear — including your own — may arise not from grief or admiration, but from envy.

“The Fault in Our Stars” is rated PG-13 (Parents strongly cautioned). Normal adolescent language and behavior, but not too much of it.

Correction:

An earlier version of this review misidentified the disease afflicting the character Hazel Grace Lancaster. It is thyroid cancer, not lymphoma.