SPOILER ALERT: This post discusses the endings of several movies, including “The Visit,” which opened in theaters on Friday.

In a career that has has seen M. Night Shyamalan plummet from the stratospheric heights of “The Sixth Sense” to the critical pits of “The Last Airbender” and “After Earth,” the filmmaker once known for twist endings may have just pulled off his biggest surprise yet. His new film “The Visit” is his best-reviewed film in 13 years, not to mention the first since “Signs” to receive a “certified fresh” rating from the review aggregation site Rotten Tomatoes, which called the new horror-comedy a “welcome return to form.”


A scene from M. Night Shyamalan’s “The Visit.” (Universal Pictures)

After directing and writing a string of four box-office hits with twist endings, Shyamalan largely abandoned his signature plot device with his 2006 release “Lady in the Water,” a bizarre fantasia inspired by a bedtime story he had made up for his kids. (Although some have argued that Shyamalan’s follow-up to “Lady,” an eco-horror story called “The Happening,” has a twist ending, it does not. The substance that is turning people into suicidal zombies turns out to be a toxic agent released by angry trees. Not only is this a stupid idea on the face of it, but it’s revealed early in the film.)

[Review: ‘The Visit’ is something of a return to form for M. Night Shyamalan]

Since “Citizen Kane’s” revelation that its antihero’s dying word — “rosebud” — referred not to a secret lover but to a childhood sled, the plot twist has been a cinematic staple. It has been used to great effect in such films as “Psycho” (murderer Norman Bates has been pretending to be his own dead mother); “Soylent Green” (Soylent Green is made out of people); and “The Crying Game” (Dil is a dude).

More recent examples include “The Gift,” in which Jason Bateman’s character turns out not to be the innocent victim of the stalker Gordo (Joel Edgerton), but Gordo’s sociopathic childhood tormentor. The forthcoming “Goodnight Mommy” (opening Sept. 25), is a German psychological thriller about twin boys who come to believe that their mother — who has just had facial surgery — is an impostor. It has a killer twist ending, but we we won’t reveal it here since it hasn’t opened yet.

For Shyamalan’s oeuvre, which has been much dissected, we feel no such compunction. Here’s how “The Visit” stacks up against Shyamalan’s previous twists, from boffo to bust.

1. The Sixth Sense (1999)

Plot: A young boy who claims to be able to see dead people consults a shrink about his problem.

Twist: The shrink is also dead.

Does it work? Seamlessly and utterly. The big reveal retroactively changes your interpretation of everything that came before it, and it is chilling.

If you liked this, you might love: “The Others.”

 

2. The Village (2004)

Plot: Residents of a 19th-century village are terrorized by creatures that live in the woods surrounding their cloistered community.

Twist: The village is actually in the middle of a modern nature preserve, where it was set up by people fleeing the crime and corruption of contemporary life.

Does it work? If you let it. The stilted dialogue is a tad silly, but in no other movie is Shyamalan so committed to his central conceit.

If you like this, you might love: “Planet of the Apes.”

 

Director M. Night Shyamalan returns to his roots with the terrifying story of a brother and sister who are sent to their grandparents' remote Pennsylvania farm for a weeklong trip. Once the children discover that the elderly couple is involved in something deeply disturbing, they see their chances of getting back home are growing smaller every day. (Universal Pictures)

3. The Visit (2015)

Plot: Two teenage siblings spend a week at the home of their grandparents, whose behavior grows more disturbing and violent by the day.

Twist: They’re not really their grandparents, who lie murdered in the basement.

Does it work? Pretty much. Shyalaman lulls you into a sense of complacency with a seemingly lazy, found-footage style of film-making, only to reveal the clever contrivance underlying what is, at heart, a campy campfire story.

If you like this, you just might love: “Silent House.”

 

4. Unbreakable (2000)

Plot: An ordinary guy named David — the sole survivor of a train derailment — comes to believe that he is invincible.

Twist: The man who convinces David of his invincibility turns out to have engineered the train derailment and other fatal disasters.

Does it work? Not really. Although the movie’s not bad as a whole and the premise is clever, the twist, as such, doesn’t have much torquing power. Doesn’t every superhero movie have to have a villain?

If you liked this, you just might love: “Arlington Road.”

 

5. Signs (2002)

Plot: Aliens invade Earth, beginning with a small Pennsylvania farm, where a former minister and widower with two children is having a crisis of faith.

Twist: The secret to defeating the aliens is water, which the widower’s young daughter has conveniently left sitting around the house in dozens of half-drunk glasses.

Does it work? No. There’s too much going on here: personal grief, the end of the world, hydrophobia. What was the twist again?

If you like this, you just might love: “Super 8.”