After nearly nine months of negotiations, Comcast, the nation’s largest cable operator, announced an agreement on Thursday to acquire NBC Universal from the General Electric Company.

The deal valued NBC Universal at about $30 billion.

The agreement will create a joint venture, with Comcast owning 51 percent and G.E. owning 49 percent. Comcast will contribute to the joint venture its stable of cable channels, which includes Versus, the Golf Channel and E Entertainment, worth about $7.25 billion, and will pay G.E. about $6.5 billion in cash, for a total of $13.75 billion. For now, the network will remain NBC Universal, but ultimately Comcast could decide to change the name.

Almost immediately, the transaction reshapes the nation’s entertainment industry, giving a cable provider a huge portfolio of new content, even as it raises the sector’s anxieties about the future.

In a joint statement announcing the agreement, Brian L. Roberts, the chief executive of Comcast, said the deal was “a perfect fit for Comcast and will allow us to become a leader in the development and distribution of multiplatform ‘anytime, anywhere’ media that American consumers are demanding.” The deal’s genesis lies in frequent flirtations over the last several years between Comcast and General Electric, although serious talks began in March. For Comcast, the purchase is the realization of its long-held ambition to be a major producer of television shows and movies.