The deal values DreamWorks at approximately $3.8 billion and implies a 27 percent premium to the stock's Wednesday closing price of $32.20.
Shares in DreamWorks soared 24 percent in early trading Thursday, hitting a fresh 52-week intraday high. Comcast shares were up slightly after the announcement.
The transaction is expected to close by the end of 2016. When it's completed, DreamWorks CEO Jeffrey Katzenberg will become chairman of DreamWorks New Media and a consultant to NBCUniversal.
"Having spent the past two decades working together with our team to build DreamWorks Animation into one of the world's most beloved brands, I am proud to say that NBCUniversal is the perfect home for our company; a home that will embrace the legacy of our storytelling and grow our businesses to their fullest potential," Katzenberg said in a statement.
NBCUniversal CEO Steve Burke said DreamWorks is a great addition to the company and will help it "grow [its] film, television, theme parks and consumer products businesses for years to come."
"Adding DreamWorks to NBCUniversal will help us accelerate all three of these lines of business in the future. ... This acquisition is a statement about NBCUniversal's commitment to keep building and investing in the creative part of the business," Burke told CNBC.
DreamWorks will bring a number of popular film franchises to NBCUniversal including "Shrek," "Madagascar," "Kung Fu Panda" and "How to Train Your Dragon."
Disclosure: Comcast is the owner of NBCUniversal, the parent company of CNBC and CNBC.com.
— CNBC's Julia Boorstin contributed to this report.