Thriller "The Perfect Guy" narrowly beat out horror film "The Visit" for first place at the weekend box office, picking up a leading $26.7 million.

“The Perfect Guy” has more than doubled its million budget in a single weekend, putting it on a path to profitability. (AP)

Thriller “The Perfect Guy” narrowly beat out horror film “The Visit” for first place at the weekend box office, picking up a leading $26.7 million.

“The Visit,” M. Night Shyamalan’s return to the shock and chills genre that made famous with “The Sixth Sense,” was close behind with a sterling $25.7 million. Going into the weekend both films were expected to pull in between $15 million and $17 million.

“The Perfect Guy” has more than doubled its $12 million budget in a single weekend, putting it on a path to profitability. The story of a successful lobbyist (Sanaa Lathan) who rebounds from a breakup with a Mr. Wrong (Michael Ealy), who turns out to have a dangerous side, was backed by Sony’s ScreenGems’ division.

The studio had a similar success on the same weekend last year when “No Good Deed,” a thriller with Idris Elba and Taraji P. Henson that debuted to $24.2 million.

“It’s ideal timing, because there’s not a lot of competition in the marketplace and you can really stand out with a slightly lower spend,” said Josh Greenstein, president of worldwide marketing and distribution at Sony.

In order to bring its audience while keeping costs at a minimum, the studio aggressively went after African-American audiences. It launched a BET Awards takeover for “The Perfect Guy” and also debuted a customized trailer to appear alongside “Straight Outta Compton” that was wordless save for Nina Simone’s “I Put a Spell On You.”

“We wanted to sell it as a sexy, taut thriller,” said Greenstein.

“The Visit” arrives courtesy of Blumhouse, the micro-budget creator of “Sinister” and “Paranormal Activity, and cost a slender $5 million to produce. Universal distributed the film in 3,069 theaters. Its success represents a comeback for Shyamalan whose career was colder than one of those “Sixth Sense” dead people after “The Last Airbender,” “Lady in the Water” and “After Earth” all flopped.

The strong grosses for both films helped push overall ticket sales up more than 15% from the year-ago period when “No Good Deed” and “Dolphin Tale 2” topped charts.

Not every new release was so lucky. Samuel Goldwyn’s “90 Minutes in Heaven” failed to connect with faith-based crowds, earning a meagre $2.2 million across 878 theaters. It may have been overshadowed by the continued strength of “War Room.” The Sony Pictures and Affirm’s faith-based family drama was third place at the box office, taking in $7.4 million for the weekend and bringing its domestic haul to $39.2 million. It is the highest grossing film of filmmaking brothers Alex Kendrick and Stephen Kendrick’s career, topping 2011’s “Courageous” and its $34.5 million total.

The top five was rounded out by Broad Green’s “A Walk in the Woods” with $4.7 million, bringing its total to $19.9 million, and Paramount’s “Mission: Impossible – Rogue Nation” with $4.1 million, pushing its domestic gross to $188.2 million.

“The Perfect Guy” and “The Visit” both tried to appeal to different segments of the movie-going public — the former made its pitch to African-American audiences, while the latter appealed to younger ticket buyers — although there was some demographic overlap in who showed up.

“The Perfect Guy’s” opening weekend crowd was 70% female, 41% under the age of 25, 61% African-American, 20% Caucasian, and 13% Hispanic. “The Visit” brought in a group that was 48% under the age of 21, 60% female, 39% Caucasian, 39% Hispanic, and 10% African American.