NEW YORK - For the first time in more than two years, a straight-up comedy is No. 1 at the box office. Kevin Hart and Tiffany Haddish's “Night School” debuted with $28 million in ticket sales, according to estimates Sunday.

The race for the weekend top spot was, in the end, a laugher. Warner Bros.' animated release “Smallfoot,” which cost about $80 million to make, trailed in second with $23 million.

Not since Melissa McCarthy's “The Boss” topped the box office in April 2016 has a comedy that didn't mix other genre elements been No. 1. The romantic comedy “Crazy Rich Asians” was a huge success, leading the box office for four straight weeks, and Tyler Perry's two horror-comedies - “Boo! A Madea Halloween” and its sequel - both opened at the top.

But big-screen comedy has been in a tailspin for years. It took two of comedy's biggest names teaming up to push Universal's “Night School” to the year's best comedy opening.

“We've been very consistent in this genre,” said Jim Orr, distribution chief for Universal. “When you get in business with people like Kevin Hart and Tiffany Haddish who are just on fire, and then really extraordinary filmmakers like (producer) Will Packer, that's how you get good results.”

More than most studios, Universal has stuck by comedy. This year, it also released the prom-night farce “Blockers” ($60.1 million worldwide on a $21 million budget) and the comic musical “Mamma Mia! Here We Go Again” ($390.1 million worldwide on a $75 million budget).

It's the second straight No. 1 for Universal, which last week led ticket sales with the Amblin Entertainment-produced fantasy “The House With a Clock in Its Walls.” It earned $12.5 million in its second weekend.

“We have a very diverse approach to our slate,” Orr said. “We're not just superhero movies or anything else like that. When you see these kinds of results, you know that that's the right thing to do, that it pays off.”

Frights not laughs have become the hotter attraction at the movies, but for one weekend at least, horror and comedy switched roles. Lionsgate's Halloween-themed “Hell Fest” debuted meekly with $5.1 million.

“Over the last few years, comedy has just taken a real roller coaster ride with audiences either not locking into the premise or not vibing with the stars,” said Paul Dergarabedian, senior media analyst or comScore. “The quality, or at least the perceived quality of many of the movies, especially the R-rated comedies, has been so bad that time after time people got disenchanted by the genre.”

“Night School,” in which Hart plays a man who returns to his high school to get his GED certificate (Haddish plays his teacher), fared poorly with critics, earning a 30 per cent “fresh” rating on Rotten Tomatoes. But the draw of Hart and Haddish was enough to supersede bad reviews. This is Hart's 11th No. 1 film.

It also helped that “Night School” reteamed Haddish with director Malcolm D. Lee. Their “Girls' Trip” was 2017's biggest comedy hit, making $140.4 million globally. “Night School” drew a diverse audience: 37 per cent white, 30 per cent African-American and 24 per cent Hispanic.

David Lowery's “The Old Man & the Gun,” which Robert Redford has said will be his final film as an actor (though he's wavered on that), opened in five theatres, scoring a strong per-screen average of $30,000. Redford plays an aged bank robber in the heist film co-starring Sissy Spacek and Casey Affleck.

And “Free Solo,” National Geographic's documentary about rock climber Alex Honnold's ropeless ascent of Yosemite's El Capitan, grossed $300,804 in four theatres. The per-screen average of $75,201, the company said, is the best screen-average opening ever for a documentary.

National Geographic debuted E. Chai Vasarhelyi and Jimmy Chin's film not just in the usual limited-release cities of New York and Los Angeles, but in climbing capitals Denver and Boulder, Colorado.

The “Night School”-led weekend - up 15.5 per cent compared with last year - helped Hollywood score the second-best September at the box office. It follows September 2017, when “It” set records. Warner Bros.' horror spinoff “The Nun” ($330 million worldwide) was this month's top film.

Estimated ticket sales for Friday through Sunday at U.S. and Canadian theatres, according to comScore. Where available, the latest international numbers for Friday through Sunday also are included. Final domestic figures will be released Monday.

1. “Night School,” $28 million ($5.5 million international).

2. “Smallfoot,” $23 million ($14 million international).

3. “The House With a Clock in Its Walls,” $12.5 million ($9.4 million international).

4. “A Simple Favor,” $6.6 million ($7.1 million international).

5. “The Nun,” $5.4 million ($16.2 million international).

6. “Hell Fest,” $5.1 million.

7. “Crazy Rich Asians,” $4.2 million ($3.2 million international).

8. “The Predator,” $3.7 million ($7 million international).

9. “White Boy Rick,” $2.4 million.

10. “Peppermint,” $1.8 million ($1.3 million international).

Estimated ticket sales for Friday through Sunday at international theatres (excluding the U.S. and Canada), according to comScore:

1. “The Nun,” $16.2 million.

2. “Johnny English Strikes Again,” $14.2 million.

3. “Smallfoot,” $14 million.

4. “Incredibles 2,” $11.9 million.

5. “The House With a Clock in Its Walls,” $9.4 million.

6. “Cry Me a Sad River,” $7.9 million

7. “The Great Battle,” $7.3 million.

8. “A Simple Favor,” $7.1 million.

9. “Golden Job,” $7.1 million.

10. “The Predator,” $7 million.