Will Ferrell’s “Talladega Nights: The Ballad of Ricky Bobby” took the checkered flag this weekend, topping all other movies in box-office sales, according to industry estimates.

The NASCAR spoof sped past competitors with $47 million in receipts, making it Hollywood’s second biggest nonsequel opening by a comedy, trailing only “Bruce Almighty” in 2003, which raked in $68 million.

“Barnyard: The Original Party Animals” finished second over weekend, with $16 million, followed by “Pirates of the Caribbean: Dead Man’s Chest,” at $11 million, “Miami Vice,” with $9.7 million, and “The Descent,” at $8.8 million.

“Talledega” is “one of those movies – pardon the pun – firing on all cylinders,” said Rory Bruer, president of distribution for Sony Pictures Entertainment, which produced the film. “When you have Will Ferrell and NASCAR, you just know you are going to have a crowd-pleaser. But this is way beyond expectations.”

The Paramount backers of animated “Barnyard” said they didn’t mind second place.

“It was at the high end of anybody’s expectations,” said Don Harris, executive vice president for distribution at Paramount.

Meanwhile, overall box-office sales are up 17 percent in year-to-date totals over 2005.

“Hollywood’s on a roll. Last year at this time, it was all gloom and doom . . . this is a terrific summer,” said Paul Dergarabedian, president of Exhibitor Relations, which tracks box-office totals.