Despicable Me 2

Despicable Me 2 beat The Lone Ranger to claim the No. 1 spot at the box office over the Fourth of July holiday weekend.

The sequel had one of the best openings ever for an animated film, Box Office Mojo reports, earning $82.5 million over the weekend and $142 million total over its five-day opening.

The Lone Ranger, however, opened at No. 2 with an underwhelming $29.4 million for the weekend. The adaptation of the popular TV show, starring Johnny Depp and Armie Hammer, took in just $48.9 million in its first five days of release.

Photos: The best summer movies ever

The Melissa McCarthy/Sandra Bullock comedy The Heat fell to third place in its second week, with $25 million. Last week's No. 1 movie, Monsters University, dropped to fourth place with $19.6 million. Rounding out the top five was Brad Pitt's zombie flick World War Z, which brought in $18.2 million in its third week in theaters.

White House Down came in at No. 6 with $13.5 million, and in seventh place was Man of Steel with $11.4 million.

Also opening this weekend was Kevin Hart's stand-up comedy film, Let Me Explain, which performed well and landed in eighth place with $10.1 million.

At No. 9 was This is the End ($5.8 million) and closing out the Top 10 was Now You See Me ($2.7 million).