San Diego-based Sempra Energy reached a deal to buy control of Oncor Electric, operator of the largest electric transmission and distribution system in Texas.

Sempra announced that its $9.45 billion offer to acquire Energy Future Holdings, a bankrupt Texas utility that owns 80 percent of Oncor, was accepted, beating out a $9 billion bid put forward by Warren Buffett’s Berkshire Hathaway Energy two months ago, according to media reports.

The enterprise value of the transaction is about $18.8 billion, including the assumption of Oncor's debt. As such, the deal would resolve Energy Future’s long-running bankruptcy case, according to a Sempra news release. It also calls for investing $7.5 billion over five years in capital projects to expand Oncor's electrical grid infrastructure.

"With its strong management team and long, distinguished history as Texas' leading electric provider, Oncor is an excellent strategic fit for our portfolio of utility and energy infrastructure businesses,” said Debra L. Reed, Sempra’s chairman, president and CEO, in a news release.

Sempra is a Fortune 500 energy services holding company that reported 2016 revenues north of $10 billion. Among its holdings is San Diego Gas & Electric.

Sempra expects the deal to be completed in the first half of 2018, though it’s subject to approval from the Public Utility Commission of Texas, among other agencies.