LOS ANGELES  -- Comcast said Tuesday that it's buying the rest of NBCUniversal from General Electric for $16.7 billion, doing so several years early as the cable TV provider takes advantage of low borrowing costs and what CEO Brian Roberts called a "very attractive price."

At the same time, Comcast Corp. raised its annual dividend 20 percent to 78 cents per share and vowed to buy back $2 billion in shares this year. It is also buying NBCUniversal's headquarters at 30 Rockefeller Plaza in New York and the CNBC headquarters in Englewood Cliffs, N.J., for another $1.4 billion.

Investors thought the move was good for both companies - GE because it got cash for its stake earlier than expected and Comcast because it will benefit more from the rising price of rights to sports and other TV programs. With the NBCUniversal businesses, Comcast avoids solely being in the uncomfortable position of passing those costs onto consumers.

Comcast's stock jumped $2.53, or 6.4 percent, to $41.46 in after-hours trading, following the announcement. GE shares rose 81 cents, or 3.6 percent, to $23.39.

Comcast is the nation's largest cable TV operator, a business that generates nearly two-thirds of its revenue. The NBCUniversal business makes up the rest and includes the NBC and Telemundo broadcast networks, pay TV channels such as as USA, CNBC, Bravo and SyFy, the Universal Pictures movie studio and theme parks in Florida and California.

Comcast bought a 51 percent stake in NBCUniversal in January 2011, while General Electric Co. had the remaining 49 percent. Comcast had planned to take a larger stake in it over seven years, paying for it from operating cash, starting in July 2014.

But Roberts told The Associated Press that the sale of its stake in pay TV network A&E and some wireless spectrum gave it plenty of cash on hand. He also said Comcast got a good deal given that the market value of media conglomerates has been rising.

"We thought that we would have to pay more later," he said. "We really have known we wanted to buy 100 percent from the beginning of the transaction. We wanted to learn the business ... we feel that now is an opportune time."

Jonathan Atkin, an analyst with RBC Capital Markets, said the transaction will make Comcast less vulnerable to rising TV programming costs. He compared it to Time Warner Cable Inc., whose shares have plunged 13 percent since it reported in late January that profit margins were being squeezed by higher programming costs.

"Look at what happened to Time Warner Cable," Atkin said. "Comcast, as slightly more diversified conglomerate, is less exposed to that."

The deal, expected to close by the end of March, values NBCUniversal at around $34 billion, and it has about $5 billion in debt. When Comcast bought the 51 percent stake in the company in January 2011, it was valued at around $30 billion.

The company said it would finance the deal with $11.4 billion of cash on hand, $4 billion in debt owed to GE, $2 billion from its own credit lines and $725 million in preferred stock issued to GE.

Comcast also posted its earnings results a day early, saying earnings rose 18 percent to $1.52 billion, or 56 cents per share, in the quarter through December. Excluding a favorable income tax adjustment, adjusted earnings came to 52 cents per share, falling short of the 54 cents per share expected by analysts polled by FactSet. Revenue rose 6 percent to $15.94 billion, also slightly below the $16.01 billion analysts were expecting.

Comcast lost just 7,000 video subscribers in the quarter, the best result in at least five years, ending the year with 22 million.

Roberts called the earnings results "great," saying that if it weren't for Superstorm Sandy, it would have added video subscribers for the first time in many years.

Comcast had bought the stake in NBCUniversal from General Electric Co. for $6.2 billion in cash and contributed its pay TV networks such as E! and The Golf Channel worth $7.25 billion. The deal closed after a year of regulatory scrutiny. The government imposed conditions intended to prevent Comcast from keeping NBC programming to itself at the detriment of other cable operators and video websites. One condition was that it would no longer have a say in the video website Hulu, which it jointly owns with the parent companies of ABC and Fox.

As part of that deal, GE's stake in NBC Universal fell to 49 percent from 80 percent, but GE had planned to diminish that to zero by being paid out from the venture. Before the Comcast deal closed, GE bought out the 20 percent stake held by France's Vivendi SA for $5.8 billion in order to complete the deal.

As part of Comcast's takeover, NBC Universal changed its corporate logo to NBCUniversal - without the space, the peacock or the globe silhouette. Officially, the company's name is still NBC Universal, but the space-less design was meant to represent the unity of its two main divisions. In December, Comcast appended NBC's peacock logo on top of its corporate name in a new logo of its own.