A scene from “Girls Trip.” (Michele K. Short/Universal Pictures)

It was a weekend of movies surpassing expectations.

Two non-franchise, non-superhero movies topped the box office for the first time this summer, beating “War for the Planet of the Apes” and “Spider-Man: Homecoming.”

Christopher Nolan’s gritty World War II drama “Dunkirk” opened this weekend and ranks first at the box office, earning an estimated $50.5 million. And coming in second? Perhaps this summer’s biggest live-action comedy hit, Universal’s raunch-com “Girls Trip,” which earned an estimated $30.8 million.

The R-rated comedy from director Malcolm D. Lee features friends heading to the Essence Festival and stars four black women: Regina Hall, Jada Pinkett Smith, Queen Latifah and Tiffany Haddish.

The movie’s success comes as debates about diversity in Hollywood continue to gain steam. And the past couple of years have shown that although Hollywood traditionally undervalues movies with black and female leads, it is only to their peril. “Hidden Figures” was a box-office hit and the top-grossing movie among all the 2017 Oscar best-picture nominees.

“I have been told my entire career ‘Black women can’t open films domestically or internationally.’ Well anything is possible,” star Taraji P. Henson wrote on Instagram after the movie’s opening weekend, when it took the No. 1 spot at the box office. “Most importantly this proves that PEOPLE LIKE GOOD MATERIAL. HAS NOTHING TO DO WITH GENDER OR RACE. Agreed?!”

“Girls Trip” couldn’t be more different from “Hidden Figures,” which is based on a true story about three NASA scientists. But Lee’s feature has certainly struck a chord, and comes on the heels of underperforming live-action comedies such as “Rough Night,” “Snatched” and “Baywatch.”

By contrast, “Girls Trip” is receiving glowing reviews from critics (it has an 89 percent on Rotten Tomatoes), and audiences are really into it; the movie has an A-plus rating on CinemaScore.

“Black women can open a movie and it does not have to be about the space program, okay?” Lee, alluding to “Hidden Figures,” told the Hollywood Reporter. “Black Girl Magic is real — people want a piece of it, they want to see it, they want to be empowered by it.”

A largely female audience went to see “Girls Trip” on opening weekend, according to Box Office Mojo. The movie-tracking website found it was a racially diverse crowd: 59 percent of the audience was black, 19 percent was white, 17 percent was Hispanic and 3 percent was Asian.

The movie cost just $19 million to make, and its performance at the box office adds to Lee’s track record of making successful movies. (He made his directorial debut with “The Best Man.”)

“Funny is funny. And it’s a really funny movie,” Nick Carpou, Universal’s head of domestic distribution, told Variety. “Our four leads are excellent. If they make you laugh, you’re likely to tell your friends. That’s what’s happening here.”

Carpou noted that the box-office pull of $30 million is becoming rarer for pure comedies.

Having a studio budget for the movie allowed producer Will Packer and Lee to “give opportunities to people who might not otherwise have them — and that’s in front of the camera, as well as behind,” Packer told the Root last month.

“I love the fact that if this film works, it’s going to be a tremendous opportunity for other African American female actresses,” Packer added. “Because people in boardrooms around Hollywood will go, ‘Wow they can open a movie, audiences will go see them. This makes economic sense for us.’ And of course we all know that’s the true driver in Hollywood.”