A sneak peek at episode 2 of History's smash-hit 'The Bible' series.

A few years ago, the History Channel was best known to some as a punch line on HBO’s “The Sopranos.” Remember mobster Tony Soprano sitting alone late at night in his New Jersey McMansion eating ice cream and watching World War II documentaries about Adolph Hitler and Winston Churchill?

These days, no one is laughing at the History Channel — not with audiences like the 13.1 million viewers who tuned in last Sunday for the first two hours of “The Bible,” a 10-hour miniseries that runs through Easter Sunday.

Strong demographics, too. Opening night of “The Bible” drew 5 million viewers in the coveted 18-to-49-year-old group. No broadcast network came close on either count. The only competition was from the zombies on AMC’s “Walking Dead.” And while they drew more young viewers, they had fewer overall. “The Bible” is the most-watched entertainment program of the year on cable TV.

Nor was it a one-shot phenomenon for the History Channel. In May, “Hatfields & McCoys,” a miniseries about the feuding families starring Kevin Costner, opened with 13.9 million viewers on the History Channel. Its young audience was about a million less than “The Bible” but still larger than any network television competition on its opening night.

The History Channel is doing what ABC, NBC, CBS, Fox and the vast majority of cable channels can’t: It’s finding new viewers and scoring huge audiences in prime time. And it is doing that with programming ignored or dismissed by many mainstream critics.

Dirk Hoogstra, the executive vice president of development and programming for History, says the channel’s winning formula involves a mix of old research and new media. It couples almost two decades of continuing, on-air audience feedback to the kind of documentaries Tony Soprano was shown watching with hard-driving online and social media campaigns aimed at spreading the message about new shows. That last point takes the conversation into politics — with talk of media elites, fly-over America, culture wars and “influencers.” And that’s where the success story of the History Channel really gets interesting.

“We’ve been going since ’95 and doing these docs [historical documentaries], so we know topics and subject areas that have shown evidence of interest from our viewers,” Hoogstra says when asked how the channel chooses projects such as “The Bible” or “The Vikings,” another scripted drama series that drew 6.2 million viewers Sunday night in the time period after the religious saga.

“We’ve done documentaries on the Vikings, for example, that have popped unusually high numbers,” he says. “And we’ve done previous series where the subtopic of an episode was on the Vikings, and that one outperformed the other episodes that were about other barbarian hordes. And we use all of that to inform these big epic drama projects.”

In other words, just as Netflix uses research from its 20 million subscribers to determine which stars viewers would like to see in what kinds of stories before committing to a production like the Baltimore-made “House of Cards,” so is History Channel using almost two decades of audience feedback on its documentaries in deciding what kind of big-ticket miniseries to make.

Smart. But that’s only about subject matter. What’s really impressive is the way the Hearst- and Disney-owned channel gets the word out on a series like “The Bible” using social media, conservative online outlets and media-savvy church leaders. While Hoogstra talks at length about social media, he largely sidesteps the political part of the story.

“Because there’s so much original content now on television, from cable and now places like Netflix and DirecTV, you’ve got to find ways to cut through and get people to notice you,” Hoogstra says. “And one of the ways to do that is to get people who have big social followings on Twitter.”

Using the term “influencers” to describe them, the History executive says, “There are some people out there that have an enormous amount of influence over huge groups of people. If they tweet, ‘Watch “Viking” on Sunday,’ they’re likely to take that advice.”

One of those “influencers” on “The Bible” is Rick Warren, pastor of the Saddleback Church in Southern California, who has led study groups and webcasts on the series at his megachurch.

On March 3, @RickWarren tweeted to his 908,000 followers:” Watch the World Premier of #TheBible, tonight on History Channel 8/7pm. An epic 10 part series! Tell everyone. Please RT”

On March 4, Warren sent another tweet linking to a picture of him with husband and wife Mark Burnett and Roma Downey, the executive producers of the series. It shows him holding a gift from the couple. The cutline says: “Mark and Roma gave me a 1706 Bible for our 3yr partnership in #TheBible movie.”

Warren sent multiple tweets urging followers to retweet and watch before the premiere. He’s also quoted in the Huffington Post saying, “I have seen probably every film made on the Bible in the last 50 years. This is by far the best one.”

Warren is also an adviser on “The Bible,” in case anyone cares about whether that would influence his rave review. But then, so are pastors from virtually every megachurch from Florida to California — and they are raving as well. Burnett, the reality TV producer responsible for series like “Survivor,” and Downey, the star of “Touched by an Angel,” brought the History Channel a lot of new-media, pulpit-powered influencers as promotional partners.

The History Channel also got a big push from conservative websites such as Breitbart.com and Glenn Beck’s TheBlaze.

“From singer Christina Aguilera to ‘Glee’ star Jane Lynch, Hollywood Twitter accounts are abuzz with messages about ‘The Bible,’ a project that was created and produced by famed reality show producer Mark Burnett and his wife, actress Roma Downey (see the duo discuss the project on TheBlaze TV last week),” one of several articles at theblaze.com began last week.