The first shot of “Mr. Turner” tracks a pair of women walking past a windmill against the backdrop of shiny blue sky before it pauses to find British Romantic painter J.M.W. Turner (a brilliant Timothy Spall) standing in silhouette on top of an adjacent hill, sketching the luscious scene in detail. What follows is a two-and-a-hour portrait that sees the world exclusively through his focused gaze.

Directed by Mike Leigh, “Mr. Turner” is a first-rate match of director and subject. Less an explication of the man’s genius than an immersion into its essence, Turner is marked by persistent unhappiness and physical discomfort. However, the persistence of his talent provides a constant source of catharsis, resulting in a bittersweet experience that mirrors the artist’s own peculiar state of mind.

Aided by the palettes of cinematographer Dick Pope, Leigh crafts an environment that conveys the ebb and flow of Turner’s life, from his most successful period in the 1830s through the decline of public interest in the years leading up to his death in 1851. Turner’s most content when hurling paint at his canvases, as if chasing his ever-changing state of inspiration; away from his work he’s a lumbering and somewhat graceless figure. Spall imbues the man with inelegant quirks that simultaneously register as harsh physical comedy and indications of his outsider stature. Despite the buttoned-up nature of his Victorian society, Turner brings a rebellious attitude to the high art world, at once operating within its borders and constantly pushing against them.

Like the film about his life, Turner’s textured paintings combine realistic figures with hints of abstraction. He travels from place to place, sometimes under assumed identities, seeking out new subjects and burying himself in his work. Even when outside the studio, or spending time with his father, lovers or colleagues, he’s constantly lost in thought. Leigh drives the movie forward in a series of small moments that illustrate the extent to which Turner is alone with his art by choice.

This includes gentle conversations with his working-class father (Paul Jesson), and intermittently sexual relationship with a shy but adoring housekeeper (Dorothy Atkinson) and the romance he forms with the widow Sophia Booth (Marion Bailey). At the same time, he blithely disregards the fury of Sarah Danby (Ruth Sheen), the mother of his children, whom he constantly pushes out of his life.

“I look in the mirror and see a gargoyle,” Turner says. So does the audience, but Spall imbues his performance with grace and humanity, even if it’s most often indicated with an extensive vocabulary of squints and grunts. His communication style stands in stark contrast to the nuances of his paintings, but the disconnect suggests the degree to which Turner’s work allows him to escape his own limitations. It also imbues the movie with his dread about the modernization of the western world. His decision to pose for a photograph revolves around his mixture of curiosity and horror at the invention. “I think my time is up,” he says.

In one remarkable moment, Turner defaces a painting in his gallery to the shock and consternation of everyone around him, only to reveal his artistic intentions seconds later. Turner never explains his motives, and his behavior often comes across like a distended performance art, but it takes a toll on his temperament. Over the film’s 20-year span, Leigh renders the painter’s life as a collage of moments, as we watch him chase his life to the finish line. Yet the movie has an elegant balance, matching a tender deathbed scene with Turner’s father with later scenes of Turner’s own decline.

As usual, while Leigh takes solo credit for the screenplay, the narrative results from the filmmaker and actors’ extensive improvisation and rehearsal. While some scenes can meander, Leigh’s process once again yields a compassionate narrative in which subtle glances and asides tell the story as much as the plot itself. At one point, discussing the process of colorization with a colleague, Turner observes that “the sublime and the harmonious are contradictory.” It’s a lesson that “Mr. Turner” takes to heart in every scene.

Grade: A-

“Mr. Turner” premieres this week at the Cannes Film Festival. Sony Pictures Classics will release it later this year.