Madea’s Halloween trick? Scaring off all the other sequels at the box office.

Tyler Perry's Boo! A Madea Halloween bested Tom Cruise's latest action film, Jack Reacher: Never Go Back, topping the weekend with $27.6 million. The Jack Reacher sequel earned $23 million.

"The star power of Madea and Tyler Perry is undeniable," says Paul Dergarabedian, senior media analyst for comScore. "It's perfectly timed and perfectly themed and it just paid off. Tom Cruise is used to being No. 1, but in this case, Madea was a very formidable competitor."

Audiences liked Madea best, too, awarding Boo! an A grade on CinemaScore. Jack Reacher: Never Go Back earned a B-plus.

A horror sequel, Ouija: Origin of Evil, claimed No. 3, earning $14.1 million (though audiences gave Ouija a middling C). "It's another horror movie this year that has done very well," says Dergarabedian, citing the success of 2016 scare fare such as The Conjuring 2, Lights Out, Don't Breathe and The Purge: Election Year.

Holdovers The Accountant ($14 million), The Girl on a Train ($7.3 million) and Miss Peregrine's Home for Peculiar Children ($6 million) took fourth, fifth and sixth.

Lagging at No. 7 was Keeping Up With the Joneses, a new comedy from Jon Hamm, Gal Gadot, Zach Galifianakis and Isla Fisher, which failed to keep pace in the weekend race, earning just $5.6 million and a B-minus on CinemaScore.

"It got lost in the shuffle of a crowded marketplace," says Dergarabedian. "It had quite a cast, but when you have Tyler Perry, whose Madea character is a brand that just keeps on delivering at the box office, Tom Cruise, who is one of the biggest movie stars in the world, and a horror movie — it's tough to rise above that."

With plentiful offerings, this is the first weekend of fall to beat the same weekend last year at the box office. "The election is providing a layer of noise on top of everything," says Dergarabedian, noting a weak fall overall. "But this weekend demonstrates with the right combination of movies, we can get this marketplace back on track."

Meanwhile, critical favorite Moonlight, starring Mahershala Ali, Naomie Harris and Trevante Rhodes, had a healthy first weekend in New York and Los Angeles, earning $414,000 in four locations. "They virtually sold out every theater they had this weekend," says Dergarabedian. "It's mind-blowing how well that movie did."

Ewan McGregor's directorial debut, American Pastoral, made $151,000 for the weekend in 50 theaters, while Michael Moore's documentary TrumpLand has earned $64,000 since opening Wednesday.

Overall, "it was a great weekend to be an indie film," says Dergarabedian.

Final numbers are expected Monday.