OMAHA, Nebraska — Warren Buffett’s Berkshire Hathaway is buying Precision Castparts Corp. for $32.36 billion.

The announcement ended a weekend of speculation that a deal was in the works between the legendary investor and the maker of components for aircraft, power plants and other industrial uses.

Berkshire will pay $235 per share in cash for Precision Castparts’ outstanding stock. The deal is valued at about $37.2 billion, including debt.

Precision Castparts will keep its name and continue to be based in Portland, Oregon.

Berkshire Hathaway is known for being involved in large transactions, among them the combination of Kraft and Heinz. It owns various businesses, including insurance and railroad companies, utility, clothing, furniture, brick, carpet, jewelry and pilot training firms. Berkshire Hathaway also has major investments in such companies as Coca-Cola, IBM and Wells Fargo & Co.

Precision Castparts does a lot of business with the energy sector, and it’s taken a hit with oil prices now nearing a six-year low.

Buffett told CNBC that he would have bought the company even if he knew that energy prices were in the midst of a multiyear slump.

“We’re going to be in this business for 100 years, so it doesn’t really make any difference what oil and gas does in the next year,” Buffett said.

The boards of Precision Castparts and Berkshire Hathaway Inc. unanimously approved the transaction, which is expected to close in 2016’s first quarter.

Shares of Precision Castparts surged $38.37, or 19.8 percent, to $232.25 in Monday premarket trading.