Berkshire Hathaway, the giant conglomerate that Buffett runs, said yesterday that it will buy the food giant for about $23 billion, adding Heinz ketchup to its stable of prominent brands.

Buffett is teaming with 3G Capital Management, a Brazilian-backed investment firm that owns a majority stake in a company whose business is complementary to Heinz’s: Burger King.

Under the terms of the deal, Berkshire and 3G will pay $72.50 a share. Including debt, the transaction is valued at $28 billion.

“This is my kind of deal and my kind of partner,” Buffett told CNBC yesterday. “Heinz is our kind of company with fantastic brands.”

In many ways, Heinz fits Buffett’s deal criteria almost to a T. It has broad brand recognition — besides ketchup, it owns Ore-Ida and Lea & Perrins Worcestershire sauce — and has performed well. In the past year, its stock has risen 17 percent.

Buffett told CNBC that he had a file on Heinz dating to 1980. But the genesis of yesterday’s deal actually lies with 3G, an investment firm backed by several wealthy Brazilian families, according to a person with direct knowledge of the matter.

One of the firm’s principal backers, Jorge Paulo Lemann, brought the idea of buying Heinz to Berkshire about two months ago, this person said. Buffett agreed, and the two sides approached Heinz’s chief executive, William R. Johnson, about buying the company.

“We look forward to partnering with Berkshire Hathaway and 3G Capital — both greatly respected investors — in what will be an exciting new chapter in the history of Heinz,” Johnson said in a statement.

Berkshire and 3G each will contribute about $4 billion in cash to pay for the deal; Berkshire also will pay $8 billion for preferred shares. The rest of the cost will be covered by debt financing raised by JPMorgan Chase and Wells Fargo.

Buffett told CNBC that 3G will be the primary supervisor of Heinz’s operations, saying, “Heinz will be 3G’s baby.”