Viacom shares are up more than 9% following the announcement this morning that its channels will remain on Dish Network for several years — ending a war of words and threats that the programming might go dark.

The announcement adds that “select Viacom live and Video-On-Demand content” — including Comedy Central, BET, Spike, MTV, and Nick Jr. — will run on the satellite company’s Sling TV streamed service. The companies don’t say when the programming will appear, or how it will be packaged.

The companies also didn’t disclose key terms, including price.

But the programmer says that today’s deal, along with others, will “drive Viacom’s annual affiliate fee growth with our traditional distribution partners at solid mid-single-digit rates.” Viacom says its recent multi-year agreements protect its distribution to providers that reach 44 million subscribers including AT&T, Charter, Frontier, and Mediacom.

Dish CEO Charlie Ergen praised Viacom’s “creative, bold and consumer-friendly approach [that] extends a nearly 20-year-old relationship.”

And Viacom chief Philippe Dauman says the renewal, along with other deals, “will enable Viacom to drive growth and deliver better, more engaging viewer experiences for years to come.”

Viacom has 25 channels, but today’s deal just applies to the ones that Dish already carries. They include Nickelodeon, Comedy Central, MTV, VH1, Spike, BET, CMT, TV Land, Nick Jr., and Nicktoons.

Viacom investors are breathing a sigh of relief.

The agreement “takes away the most major bear case” for Viacom and “likely allows the company more flexibility in its options regarding Paramount” as Dauman tries to sell a minority stake in the studio, Stifel Research’s Benjamin Mogil says.

Viacom might have lost as much as $1.1 billion a year in affiliate fees and ad sales if it no longer reached Dish’s nearly 14 million subscribers, Nomura Securities’ Anthony DiClemente estimated this week.

What’s more, the loss of Dish might have emboldened other distributors to drive hard bargains with Viacom. Several small cable operators including Suddenlink and Cable One dropped its channels, and said that their bottom lines improved.

Yesterday Ergen told analysts that he’s “prepared to move on as Suddenlink and others have done.” He also said that he saw a potential “path” to a deal.

“Getting a deal done avoids a catastrophic loss of profit” for Viacom and should boost its stock price, Drexel Hamilton’s Tony Wible says. Still, he says it will “trade at a substantial discount to peers” as many of the young viewers it targets favor digital video offerings over traditional pay TV.

Dish might have lost as many as 660,000 subscribers without Viacom, Wells Fargo Securities’ Marci Ryvicker figured. But after putting together the lost customer payments as well as the cost for replacement programming and promotions against the savings from payments to Viacom, she estimated that Dish’s operating cash flow might improve by as much as $104 million a year.

Dish shares are up less than 1% today. The price rose about 9% over the last five days as the companies warned about a possible split — and the satellite company reported better-than-expected earnings for Q1.