It was a battle of the sequels at the multiplexes this weekend, as “Boo! A Madea Halloween” narrowly edged out “Jack Reacher: Never Go Back” to claim first place at the domestic box office.

The latest film in the long-running Madea series racked up $27.6 million. Comedian Chris Rock may be entitled to a percentage of the gross. Creator Tyler Perry was inspired to take his pistol-packing grandma trick-or-treating after Rock’s comedian character in 2014’s “Top Five” joked that his latest movie, a passion project about a slave revolt, was going head-to-head at the box office with “Boo! A Madea Halloween.” What was once intended as satire eventually became a seasonally appropriate reality.

“This isn’t the end of the series, it’s just the beginning,” said Jeff Bock, box office analyst with Exhibitor Relations, who noted that Perry also scored with 2013’s “A Madea Christmas.” “There are so many holidays left. There’s Easter, St. Patrick’s Day, and he hasn’t even done a Thanksgiving one yet.”

Don’t look for “Boo!” to end up in the Oscar race or on many reviewers’ “ten best” lists, but the Halloween comedy is a hit for distributor Lionsgate and reaffirms Perry’s star power. Despite being routinely derided by critics, the film series has an extremely loyal fan base. Collectively they’ve earned nearly $380 million, enjoying capacious profit margins given that most of the movies cost less than a Papa John’s Super Bowl spot to produce. The latest Madea cost $20 million to make, and attracted a more diverse crowd. Typically the films have an audience that’s between 80% and 90% African-American, but this installment’s crowd was only 60% African-American, with the rest of ticket buyers made up largely of Caucasians and Hispanic movie-goers.

“The film crossed over and it expanded the audience,” said David Spitz, co-president of domestic distribution at Lionsgate. “Madea is such a beloved character and the timing helped. There are not many comedies in the marketplace right now and Halloween is right around the corner.”

“Never Go Back” was right behind, with the action sequel earning a solid $23 million. The film brought back Tom Cruise as Reacher, an ex-military investigator with a penchant for ass-kicking. The films are based on a popular series of books by Lee Childs, but despite their best-selling pedigree, a sequel to “Jack Reacher” wasn’t exactly a given. The first film ended up making money for Paramount in 2012, grossing $218.3 million worldwide on a production budget of $60 million, but it wasn’t exactly a blockbuster. The film did, however, have a healthy after-life on home entertainment platforms.

“It felt for awhile like every time I’d go on a plane, it was the movie every person was watching,” said Megan Colligan, Paramount’s president of worldwide distribution and marketing. “It was a movie that expanded its audience.”

The studio made sure that costs didn’t escalate on the sequel, keeping the budget locked at $60 million, a feat since most franchises increase their spending with each subsequent installment. They were rewarded for the cost consciousness. “Never Go Back” improved on “Jack Reacher’s” $15.2 million debut from four years ago. It’s worth noting, however, that the previous film debuted days after the Sandy Hook elementary school killings, which may have depressed turnout for the violent adventure film. Overseas, “Never Go Back” performed well, earning $31 million.

“Ouija: Origin of Evil,” the follow-up to 2014’s low-budget horror hit “Ouija,” picked up $14.1 million, a respectable return given its $9 million budget. Universal distributed the Blumhouse production, which got markedly better reviews than the original, but couldn’t translate the critical notices into a bigger opening than its predecessor. The first film in the series kicked off to $19.9 million before going on to make $103.6 million globally. Platinum Dunes and Hasbro produced the board game adaptation.

“Origin of Evil” is set in the 1960s and centers on a scam seance artist who unwittingly invites evil spirits into her home. The film’s PG-13 rating meant its audience skewed younger, with 57% of ticket-buyers clocking in under the age of 25. Universal believes the film will benefit from the holiday next week.

“Based on the fact that we’re the only wide release horror film on Halloween, we’re expecting to hold well,” said Nick Carpou, Universal’s domestic distribution chief.

Last weekend’s champ, Warner Bros.’ “The Accountant,” came in fourth, holding well to pick up $14 million. That pushes the Ben Affleck thriller’s domestic total to $47.9 million.

DreamWorks Pictures’ “The Girl on the Train” rounded out the top five, earning $7.3 million. The adaptation of the literary hit about an alcoholic who becomes obsessed with a missing woman has earned $58.9 million after three weeks in theaters. Universal distributed the film.

The weekend’s other major new release, Fox’s “Keeping Up with the Joneses,” flopped, eking out $5.6 million. The action-comedy about a suburban couple who gets entangled in the world of international espionage stars Jon Hamm, Zach Galifianakis, Gal Gadot, and Isla Fisher. It’s a rough start given its $40 million budget.

Among other releases, “The Met: Live in HD’s” screening of Mozart’s Don Giovanni drew opera fans, grossing $1.7 million on more than 900 screens.

Faith-based distributor Pure Flix debuted “I’m Not Ashamed,” a drama about a victim of the Columbine High School shootings, to $900,000 on 505 theaters.

Michael Moore waded into the presidential election with “Michael Moore in TrumpLand,” a film of a one-man stage performance that the documentary filmmaker delivered in Ohio, all but begging the Rust Belt to abandon the Donald. The film earned $50,200 on two screens for a $25,100 per-screen average.

In a statement, Moore said, “This film speaks to and is being enjoyed by many constituencies, namely the 50% of the country planning not to vote, or those voting third party, but also among Clinton supporters and even Trump voters who know better. I’m convinced now that as millions of Americans will see this movie, it will have an impact on this election.”

Rapturous critical notices lifted “Moonlight” at the art house box office this weekend. The film was bolstered by a love letter from the New York Times’ A.O. Scott, who labeled it “breathtaking” and stopped short of declaring it 2016’s best film with two months left to go in the year. The A24 release earned an impressive $414,740 on four screens, for a sizzling $103,685 per-screen average. That sets it up nicely as the indie distributor looks to expand the drama about a gay boy coming-of-age in the inner city of Miami. It could also bolster “Moonlight’s” Oscar chances.

It’s been a rough fall movie season, with ticket sales down more than 12%, but things appear to be on the upswing. Revenues were up 18% from the year-ago period, when “The Last Witch Hunter” and “Paranormal Activity: The Ghost Dimension” both bombed. Analysts believe the box office is poised for a rebound, with several big-budget offerings hitting theaters in the coming weeks, such as “Inferno” with Tom Hanks and Marvel’s “Doctor Strange.”

“This should be the start of a turnaround,” said Paul Dergarabedian, senior media analyst with ComScore. “After hitting rock bottom, now we begin climbing back.”