LOS ANGELES — Universal Pictures and a gaggle of foul-mouthed 12-year-olds proved over the weekend that, even in the Netflix epoch, comedies can still pack a box-office punch.

“Good Boys,” about the R-rated misadventures of three preteen buddies, collected an estimated $21 million at theaters in the United States and Canada, according to Comscore. That No. 1 total — the largest so far this year for an original comedy — exceeded analysts’ prerelease expectations by more than 30 percent.

“This is a franchise-level opening,” David A. Gross, a movie consultant, wrote in a Saturday report that noted the movie’s modest budget and strong scores from audiences and critics. “Good Boys” cost about $20 million to make.