Gannett Co. (GCI) on Tuesday said it will spin off its publishing business, creating two separate publicly traded companies, and confirmed it will buy full ownership of Cars.com for $1.8 billion.

Gannett said it will spin off of its publishing arm to shareholders, with the remaining company to focus entirely Gannett's broadcasting and digital business. Gannett expects the publishing business will be debt-free after the separation, as the broadcasting and digital company will retain Gannett's existing debt.

In addition, Gannett said it will buy the remaining 73% stake in online ad-listings firm Cars.com that it doesn't own. The Wall Street on Monday reported that the company was near a deal to take full ownership of the Cars.com. News of the sale was earlier reported by Bloomberg.

Gannett said it will fund the Cars.com deal with cash on hand, borrowings under its revolving credit agreement and through bond issuance of $650 million to $675 million.

The Cars.com business was put up for sale earlier this year, with hopes of generating a sale price of as much as $3 billion. The final deal values the site at $2.5 billion.

Cars.com is owned by the Classified Ventures publishers consortium. Aside from Gannett, other investors include Dallas Morning News publisher A.H. Belo Corp. (AHC); Miami Herald owner McClatchy Co. (MNI); Graham Holdings Co. (GHC), the former owner of the Washington Post; and Tribune Media Co. (TRBAA), which until Monday was part of the same company as Los Angeles Times publisher Tribune Publishing Co. (TPUB).

Classified Ventures was founded in 1997 as a way for newspaper publishers to compete in the online auto and rental classifieds businesses. Earlier this year, Classified Ventures agreed to sell its other major holding, apartments.com, to CoStar Group Inc. for $585 million.

One person familiar with Cars.com earlier this year estimated that it generates about $400 million to $500 million in revenue a year.

Write to Erin McCarthy at erin.mccarthy@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires