Kellogg announced plans Monday to sell its Keebler, Famous Amos and fruit snacks businesses to Nutella-owner Ferrero for $1.3 billion.

Ferrero beat out Hostess Brands for the cookie business, people familiar with the deal previously told CNBC. The owner of Twinkies and Ho Hos had been looking to acquire Keebler through a "Reverse Morris Trust," an unusual deal structure that allows for a tax-efficient combination of two similarly sized companies.

The Kellogg-Ferrero deal, expected to close by the end of July, was first reported by CNBC.

The acquisition is the latest in a string of deals for Ferrero. The company, founded in Italy in 1946 as a family business, entered the U.S. market in 1969 with its Tic Tac mints. In the past two years, it has built up that foothold, buying Ferrara Candy Co. for $1 billion and Nestle's U.S. candy business for $2.8 billion. Its array of brands now includes Butterfinger, SweeTarts and Crunch.

Its U.S. strategy has been to buy brands that, like Nestle's candy business and Kellogg's cookie business, have been neglected within broader food companies' portfolios. It plans to pour its resources into reinvesting and modernizing those brands. Already, it has rolled out a "better Butterfinger" with larger peanuts, more cocoa and milk and no hydrogenated oils.

"We are acquiring a portfolio of well-established brands that consumers love, with very strong market positions across their respective categories, allowing us to significantly diversify our portfolio and capitalize on exciting new growth opportunities in the world's largest cookies market, Ferrero Group CEO Lapo Civiletti said in a statement.

With the deal, Ferrero is also acquiring six U.S. food manufacturing facilities across the U.S. and a leased manufacturing plant in Baltimore.

The company had also been in the running to buy Campbell's Australian cookie business, Arnott's, CNBC first reported, but has since dropped out, people familiar said.

Kellogg, meantime, is paring back its portfolio to focus on brands it can revive, like Pringles, Cheez-Its, and Rice Krispies Treats. Shares of Kellogg, which has a market capitalization of $19.72 billion, are down nearly 11 percent over the past year. They were down fractionally Monday.

"This divestiture is yet another action we have taken to reshape and focus our portfolio, which will lead to reduced complexity, more targeted investment, and better growth," Kellogg CEO Steve Cahillane said in a statement.

"Divesting these great brands wasn't an easy decision, but we are pleased that they are transitioning to an outstanding company with a portfolio in which they will receive the focus and resources to grow."

The Corn Flakes-owner acquired Keebler in 2001 for $4.4 billion. At the time, part of its draw was the cookie brand's "direct-store delivery" platform, through which employees place the company's own products in stores, rather than ship from warehouses. So-called DSD gives a food company more control over ensuring proper display in grocery and convenience stores. But as in-store sales of products like cookies have fallen, it is less economical. Kellogg has since dropped DSD distribution.

Evercore acted as lead financial advisor to Kellogg, while Goldman Sachs acted as co-advisor. Wachtell, Lipton, Rosen & Katz provided legal counsel to Kellogg.

J.P. Morgan Securities acted as financial advisor to Ferrero, while Davis Polk & Wardwell provided legal counsel.

Watch: Kellogg explores selling cookie and fruit snack business