Firing a Shrek-size salvo over rival Amazon's bow, video-streaming service Netflix (NFLX) said Monday that it was teaming up with DreamWorks Animation to air new shows and movie releases, further altering the television-viewing landscape as viewers increasingly look to the Web for entertainment.

The news, which drove shares of both companies higher, promises good things all around: For Netflix, which withdrew earlier this year from its programming partnership with Nickelodeon, the deal means more online offerings to grab and hold on to customers, especially younger ones, who are trading traditional television for streamed content over laptops, tablets and smartphones. For DreamWorks, the creator of "Shrek," "Madagascar" and "Kung Fu Panda," the multiyear marriage will help it reduce its dependence on major movie releases at a time when a single box-office flop can sink a company's stock. And for viewers, the collaboration means more viewing options on more platforms.

"This deal represents a major expansion of what's already a phenomenal relationship," Ted Sarandos, Netflix chief content officer, said in a statement, "allowing us to bring beloved DreamWorks characters to the 40 countries where Netflix operates and setting the stage for us to innovate together as we expand into new markets."

Netflix shares closed up more than 7 percent and DreamWorks shares were up 4 percent on Nasdaq.

DreamWorks said the multiyear deal, which involves more than 300 hours of programming, is a cornerstone of a major initiative to expand its TV production and distribution.

The companies did not disclose the value of the deal or the length of the contract, the biggest that Netflix has signed for original programming.

In a note to clients, analyst Michael Pachter with Wedbush Securities questioned how much of the shared content would truly be original and wondered whether Netflix can make money from its push for original content.

But Netflix spokesman Jonathan Friedland said the content deal, the biggest ever in the company's history, is groundbreaking and that the content is brand new.

"This programming has never been seen before and it's all based on DreamWorks Animation movies or its classic characters," he said. "And because this is a global deal, we can launch these shows in the 40 countries we operate in all at the same time, which is rare in this industry."

Online streaming companies such as Hulu and even chipmaker Intel (INTC) all are spending lavishly on content as they try to establish bulkheads in the burgeoning market for movies and TV shows delivered over the Internet. Amazon, for example, wrote its biggest-ever check this month for a subscription-streaming deal, securing hundreds of mostly children's TV programs from Viacom for its Internet video service.

Netflix and DreamWorks issued a news release saying the deal makes "the world's largest Internet TV network the premiere home of new original series from the award-winning creators of global box-office hits."

As the online-streaming pioneer, Netflix has been aggressively trying to win over new subscribers in recent months, offering original series such as the Kevin Spacey drama "House of Cards" and bringing back the cult TV comedy series "Arrested Development" in May. By allowing viewers to see all 15 episodes of that show in one sitting, Netflix is tapping into a growing trend of viewers binge-watching TV series online and through DVDs.

Netflix will premiere the new DreamWorks shows in all territories where it operates. The first is expected to be available in 2014.

Until now, DreamWorks Animation's primary focus has been the release of about two costly movies a year. Its success record is strong, but one miss can send its stock price plummeting, as was the case late last year, when "Rise of the Guardians" severely underperformed expectations; the company eventually took an $87 million write-down tied to the film.

Wire services contributed to this report. Contact Patrick May at 408-920-5689; follow him at Twitter.com/patmaymerc.

Netflix-DreamWorks Animation deal
What: An agreement to share 300 hours of new shows and movie releases from DreamWorks
How long: "Multiyear" (neither company would comment on the length of the contract)
When: Content airs beginning in 2014
Where: In the 40 countries where Netflix operates
Sources: Mercury News reporting; Netflix; DreamWorks Animation