The town in the shocker “Bacurau” is fictional, a bit magical, at once ordinary and otherworldly. It’s filled with faces that have life etched in them, which helps deepen the realism. And while the story is set in the near future, it looks like the present: the charming landscapes, laughing children, crowing roosters, the grinning balladeer with a guitar. Then, the guns come out, history rushes in and a ghost pops by. (It smiles.)

In the wild world of “Bacurau,” queasy humor meets razor-sharp politics and rivers of blood. An exhilarating fusion of high and low, the movie takes a shopworn premise — townsfolk facing a violent threat — and bats it around until it all goes ka-boom. Part of what’s exciting is how the filmmakers marshal genre in the service of their ideas, using film form to deflect, tease and surprise. The movie looks and plays like a western but also flirts with dystopian science fiction and pure pulp: bang, bang, splat. By the time the cult actor Udo Kier rolls up it’s clear that anything gleefully goes.

It’s also obvious that the writer-directors Kleber Mendonça Filho and Juliano Dornelles are having a good time, and they want you to have one too. Dornelles has worked as a production designer on Mendonça Filho’s movies, including his sui generis “Neighboring Sounds” and “Aquarius.” Their partnership proves seamless on “Bacurau,” which flows despite a switch-backing story that starts with a truck bouncing along a remote highway, a woman riding shotgun. The countryside is green in the way of certain deserts, but empty coffins litter the road, along with a corpse.

It is quite the enigmatic opener, a variant on those puzzlers that begin with a body sprawled on the parlor floor next to a bloody candelabrum. But there’s no clever detective to put the pieces together. (You have to do that yourself.) There’s also no obvious narrative blueprint and precious little exposition. There are instead beauties, mysteries and characters, like that passenger, Teresa (Bárbara Colen), who arrives in Bacurau on the day of a funeral. As Teresa walks through the seemingly empty town, dragging a suitcase, she passes its boozy doctor, Domingas (Sônia Braga, the one and only). And then Teresa hails a man who pops a hallucinogen in her mouth.