“The Conjuring 2” dominated the weekend box office, racking up an impressive $40.4 million to top “Now You See Me 2” and “Warcraft.”

The horror thriller cast a powerful enough spell to ward off Hollywood’s fears of “sequelitis.” The phantom plague has become a buzzy term among studio executives after a spate of follow-ups and spinoffs, such as “Alice Through the Looking Glass” and “The Huntsman: Winter’s War,” landed with a thud.

Quality appears to have helped “The Conjuring 2” succeed where other sequels faltered. The film received a solid 73% “fresh” rating on critics aggregator Rotten Tomatoes and enjoyed an A- CinemaScore.

“It starts with a really good movie,” said Jeff Goldstein, distribution executive vice president at Warner Bros., New Line’s corporate cousin. “Then you take an outstanding director like James Wan, returning to a genre that he just owns, and match it with a perfect release date and you blaze a new trail.”

In addition to Wan, whose horror bona fides have also been burnished with his work in the “Insidious” and “Saw” franchises,” the second “Conjuring” brought back Vera Farmiga and Patrick Wilson as married paranormal investigators who travel to a haunted house outside of London.

The New Line release nearly matched the first “Conjuring’s” $41.9 million debut, but its $40 million price tag is nearly double what its predecessor cost to make. It made short work of the weekend’s other contenders. With “Conjuring 2” dominating ticket sales, Legendary and Universal’s “Warcraft” settled for second place with $24.4 million and Lionsgate’s “Now You See Me 2” took third place, debuting to $23 million.

In a less globalized business, “Warcraft’s” domestic debut would have been ruinous, given the video game adaptation’s $160 million production budget and the millions spent in marketing the film. However, “Warcraft” is getting a lift from foreign audiences, particularly moviegoers in China. The fantasy adventure has earned a scorching $156 million over its first four days in the People’s Republic.

“Now You See Me 2’s” domestic launch was respectable, but it failed to match the first film’s $29.4 million debut. Lionsgate spent more than $90 million on the sequel, which finds a band of illusionists tangling with an unethical tech baron. It sees original cast members such as Jesse Eisenberg, Mark Ruffalo and Woody Harrelson return and adds “Harry Potter” star Daniel Radcliffe to the mix. Internationally, “Now You See Me 2” picked up $22.8 million.

Richie Fay, Lionsgate’s domestic distribution co-president, said that he expected “Now You See Me 2” to show some endurance. The first film went on to make $117.7 million domestically, nearly four times its opening.

“The original performed well on home entertainment,” he noted. “It’s possible that the audience for this one could grow. People who may not have seen the first one theatrically might look forward to seeing it in theaters this time around.”

Even as moviegoers are sending mixed signals about their appetite for sequels and follow-ups, studios show no signs of abandoning their franchise obsession. Two sequels, “Teenage Mutant Ninja Turtles: Out of the Shadows” and “X-Men: Apocalypse,” rounded out the top five, earning $14.8 million and $10 million, respectively. The latest “Mutant Ninja Turtles” has grossed $61 million in two weeks, while the newest “X-Men” adventure has generated $136.4 million in three weeks.

The strong premieres of “Now You See Me 2” and “The Conjuring 2” would appear to allay concerns that sequels are at a saturation point. That narrative could be retired next weekend, after “Finding Dory,” a follow-up to 2003’s “Finding Nemo,” hits theaters. It is projected to kick off to more than $115 million, which would be the biggest debut for a Pixar release.

“It comes down to the movies,” said Paul Dergarabedian, senior media analyst at comScore. “Whether it’s sequelitis or superhero fatigue, it’s the movies themselves. If a movie delivers, people will see it.”

In limited release, “De Palma,” a look at the career of “Carrie” and “Scarface” director Brian De Palma, picked up $30,856 from three locations.

Final numbers are still being tabulated, but it appears that ticket sales will be down more than 40% against difficult year-over-year comparisons. “Jurassic World” debuted over the same weekend in 2015, setting a new domestic record with its $208.8 million opening.