The problem facing “Shopgirl” is that many viewers will expect it to be as wild and crazy as Steve Martin, who wrote it and co-stars in it. Those people will be disappointed. It has funny moments, but Martin’s novella and this film adaptation of it are more interested in examining human nature than in cracking jokes. I remember noting when I read the book a few years ago how beautiful the language was. And now I’m just as struck by the loveliness of the film.

Like most of Martin’s stories, it’s set in Los Angeles, where we meet Mirabelle Buttersfield (Claire Danes), a lonely, sad woman in her early 20s who moved to L.A. from Vermont some time ago and seems to have met almost no one since she got there. She works at the glove counter at Saks Fifth Avenue, where she fades into the background while the women at the more heavily trafficked makeup and perfume counters are showered with attention. At night she goes home to her average apartment, which she shares with a cat. She takes prescription anti-depressants. I am sad just remembering her.

She meets two men at around the same time. One is Jeremy Kraft (Jason Schwartzman), an artist with a scattered brain and a tendency toward obliviousness, the kind of man who can forget to open his date’s door for her, say, “Whoops, next time,” and sincerely believe that makes up for it. He is sweet but odd, completely wrapped up in his own weirdness — inconsiderate, technically, but not in an inconsiderate way. You know the type.

The other man Mirabelle meets is a much older gentleman named Ray Porter (Steve Martin). Some kind of career involving computers (he has a second home in Seattle) has made him wealthy, and he is generous with gifts. As thoughtless as Jeremy is, Ray is the opposite. At first his intentions toward Mirabelle — the extravagant gifts, the doting affection — seem creepy and untoward, given he is twice her age. (In real life, Martin is 60 and Danes is 26.) But then Mirabelle reciprocates, and their interaction feels more comfortable. The problem is that she begins to fall for him while he believes their relationship is merely casual.

What follows is a yearning, wistful drama about nothing less than the very nature of love itself — heady stuff for a movie written by Steve Martin, but readers of his books (I especially recommend “The Pleasure of My Company”) know he has a profound mind.

The film benefits from smooth direction by Anand Tucker (“Hilary and Jackie”), and perhaps even more from its moving musical score by Barrington Pheloung. It’s rare that a film’s underscoring has such impact, but Pheloung’s piano-and-strings compositions powerfully convey emotions in scenes that might otherwise be obscure. The music feels as much a character in the film as Mirabelle, an omnipresent, benevolent force that empathizes with her every feeling.

At one point Jimmy Fallon was slated to play Jeremy Kraft; I cannot imagine a worse mistake in all the history of the world. The role calls for depth, which is not Fallon’s strong suit. Schwartzman feels legitimate in the role, not like a daft movie character in a romantic comedy, but like a realistically flighty young man who has not yet figured out how to interact with young ladies. Martin, who must have had himself in mind when he wrote the novella, and who is a wealthy older man himself, plays a wealthy older man the way you would expect him to: with sincerity and just a touch of smarminess.

And at the center of this little universe is Claire Danes. She has generally played serious characters during her career, but her performance here is especially tender, with a vulnerability that instantly wins a viewer’s heart. “Mirabelle” is a perfect name for her, with Latin and Spanish roots that suggest “beautiful to look at.” She is, and so is the movie.

A- (1 hr., 44 min.; R, some fairly strong sexuality, one scene with nudity, a little mild profanity.)