A subtle comedy with considerable pathos, “Beatriz at Dinner” made me laugh a bit and squirm a lot. That’s its aim as it focuses on a clash between the 1-percenters among Los Angeles’ Anglo society and the Mexican immigrant working class.

At one point, John Lithgow, playing a real estate billionaire, shows Salma Hayek, an idealistic Latina health practitioner, a photo on his phone of a rhino he shot in Africa. Because such upscale safaris help fund conservation programs, he declares, “I don’t consider it murder.”

“You think it’s funny? I think it’s sick,” she says, flinging the phone back at him like a club. Written by Mike White (in a tone very different from his sweetly charming “School of Rock”) and directed by Miguel Arteta (“Cedar Falls”), the film carries powerful irony.

The setting is a gated community of McMansions where Hayek’s Beatriz, a New Age-y healer, does house-call massage for Cathy (Connie Britton). When Beatriz’s car dies, Cathy invites her to stay overnight as she awaits help. In fact, Cathy says, she should join the evening’s guests for a small dinner party celebrating a land deal that will make them all even richer.

Cathy respects Beatriz, whose empathy and care helped her daughter through a hard time in the hospital. She introduces her to the other women attending (played to catty perfection by Chloë Sevigny and Amy Landecker) as “my dearest friend.” Cathy means well, but the rest recognize privileged patronizing when they hear it. The performances are hard to watch because they’re so genuine.

The early scenes set up a restrained, play-it-straight comedy of manners. But in the U.S. in 2017, there are controversy-triggered land mines on every social pathway. Lithgow, the wonderfully named Doug Strutt, sees the unfamiliar Latina in casual clothes and greets her with, “Can I have another bourbon, hon?” When he learns who she is, he pops the inevitable question: “Did you come legally?”

Soon enough, conversational battle lines are drawn, with Beatriz as a one-woman uprising. It’s not a conflict easily fought or easily won, and the verbal swordplay isn’t a dry political allegory.

Through White’s script and Arteta’s smooth direction, most characters get a hard drubbing and a fair hearing. Doug has a grating “me first” attitude, but he’s also savvy enough to know how to play business games, and he’s somewhat curious about how the world looks from the perspective of people far below his penthouse level. Is it wrong to be a little wary about a health worker who chose her career because of the sympathy she felt for a mistreated octopus?

The film moves to a tone of Latin American magical realism as the end approaches, fantastic elements competing with objective truth. What begins as a wise comedy told from the perspective of an honorable immigrant becomes a harsh, strong and poetic account of a dark chapter in our national life.