"Ride Along," a buddy cop comedy starring Kevin Hart and Ice Cube, collected $41.2 million in ticket sales to win the weekend box office race, leaving another new release, political thriller "Jack Ryan: Shadow Recruit," in the dust.

Last week's box office winner, the Afghanistan war tale "Lone Survivor," was second with ticket sales of $23.2 million, according to studio estimates provided by tracking firm Rentrak.

In a weekend crowded with four new films, "The Nut Job," the first animated release from Open Road Films, collected $20.6 million in ticket sales to claim third place.

Starring Chris Pine as the late author Tom Clancy's fictional CIA analyst, "Jack Ryan: Shadow Recruit" took in $17.2 million over the first three days of the Martin Luther King holiday weekend for the No. 4 spot.

"Ride Along," which hip hop singer and star Ice Cube also produced, far surpassed Hollywood's $28 million opening weekend forecast and was the biggest three-day King Day holiday weekend opening ever. While only 10 of 47 reviews were favorable, according to the site Rotten Tomatoes, 94 percent of the audience surveyed on the site wanted to see it.

"The timing was really right on this one," said Nikki Rocco, president for domestic distribution at Universal Pictures which released the film, which cost about $25 million.

Noting that there had not really been another comedy since "Anchorman 2," which opened a month ago, Rocco said the audience skewed surprisingly female - 57 percent - and that "Ride Along" had even turned into a bit of a date movie.

Audiences graded it an A, according to CinemaScore which polls people who have seen films, boding well for the coming weeks, Rocco added.

"The Nut Job," the first animated film from Open Road Films, a joint between theater giants AMC Entertainment and Regal Entertainment Group, benefited from playing in more than 3,400 theaters, according to the site Box Office Mojo, about the same as "Jack Ryan: Shadow Recruit" but far more than "Ride Along," which played in around 2,700.

Weekend sales for "The Nut Job" ranked as the biggest opening for an animated film not produced by a major studio, beating out the $16.8 million for 2009 film "Coraline." "Nut Job" cost about $30 million to make after tax rebates.

Pine, best known for his role as Captain Kirk in the 2009 film "Star Trek," is the fourth actor to play Jack Ryan in the fifth film based on the late Clancy's character.Alec Baldwin, Harrison Ford and Ben Affleck have all played the part.

The film, a reboot of the movie series featuring a younger Pine, took more than five years to make it to the screen.

Paramount, the studio behind it, put it on hold when Pine was cast its "Star Trek" film, and said on Sunday that the opening box office was in line with expectations.

Rounding out the top five, Disney's animated hit "Frozen" took in just under $12 million.

Academy Award nominee "American Hustle" was sixth with $10.6 million in ticket sales. Two other top-nominated films, "Gravity" and "12 Years a Slave," returned to theaters after having largely ended their runs.

The low-budget horror film "Devil's Due" opened with $8.5 million in sales for the No. 7 slot.

Viacom's Paramount Pictures released "Jack Ryan: Shadow Recruit. "The Ride Along" and "Lone Survivor" were distributed by Comcast's Universal Pictures. Fox, a unit of Twenty-First Century Fox, released "Devil's Due." Open Road Films, a joint between theater giants AMC Entertainment and Regal Entertainment Group, released "The Nut Job".