Kevin Hart and Tiffany Haddish’s “Night School” opened with $27.3 million in North American ticket sales, making it the first straight-up comedy to debut No. 1 at the box office since Melissa McCarthy’s “The Boss” in April 2016.

In what was expected to be a close race, Universal’s “Night School” easily bested the Warner Bros. animated release “Smallfoot,” according to final box-office figures Monday. “Smallfoot,” which cost about $80 million to make, came in second with $23 million.

In limited release, David Lowery’s heist movie “The Old Man & the Gun” — featuring what Robert Redford has said will be his final performance — opened in four theaters for a strong per-screen average of $30,000. “Free Solo,” National Geographic’s documentary about rock climber Alex Honnold’s ropeless ascent of Yosemite’s El Capitan, grossed an impressive $300,804 in four theaters, good for the best screen-average opening ever for a documentary.

The top 20 movies at U.S. and Canadian theaters Friday through Sunday, followed by distribution studio, gross, number of theater locations, average receipts per location, total gross and number of weeks in release, as compiled Monday by comScore:

1. “Night School,” Universal, $27,257,615, 3,010 locations, $9,056 average, $27,257,615, 1 Week.

2. “Smallfoot,” Warner Bros., $23,045,635, 4,131 locations, $5,579 average, $23,045,635, 1 Week.

3. “The House With a Clock In Its Walls,” Universal, $12,605,120, 3,592 locations, $3,509 average, $44,858,345, 2 Weeks.

After the numbers dropped, Hart took to Instagram Monday to thank all his fans.