As recently as Friday, merger talks between Halliburton and Baker Hughes weren't going well.

But now, we have a deal.

Halliburton (HAL) said Monday it will spend $34.6 billion to acquire Baker Hughes (BHI).

The deal between the second- and third-largest companies in the industry would form an energy giant with more than 136,000 employees.

The merger comes as the price of crude oil plummets, pressuring profits at oil exploration companies.

Combining will allow the new company to cut costs -- or, as they said, "yield annual cost synergies of nearly $2 billion." Company officials called that a "conservative" number that can be reached by cutting duplication, like multiple offices and staff -- "duplicate footprints" -- in similar places.

Regulators to scrutinize: Halliburton said it is "confident" the deal will past muster with government regulators in the U.S. and other countries, who are expected to review it closely.

Halliburton said it hired "the best antitrust counsel available" and would begin meeting with Justice Department officials on Monday morning.

The Halliburton name has a lot of clout in Washington. It has spent $360,000 on lobbying so far this year, according to the Center for Responsive Politics, a watchdog group. The Center also said Halliburton and its employees reported contributing $615,000 to candidates and groups in the midterm elections.

From foes to friends: Just days ago, the companies appeared to be at loggerheads.

Baker Hughes announced the talks Thursday, and on Friday it said Halliburton was attempting to "pressure" it into a deal "on Halliburton's terms" and take over its board of directors. It also released letters from its CEO, Martin Craighead, to Halliburton CEO Dave Lesar.

"Your intransigence is not a reasonable response," he wrote in one, "and your demand that we accept your offer in the next four hours ... (is) entirely inappropriate."

Lesar will lead the new company and three members of Baker Hughes' board will join Halliburton's board.

The news sent Baker Hughes stock soaring nearly 16% before the bell. Halliburton was down about 4%.

The H-Word: Just a few years ago, Halliburton was a political buzzword, used by Democrats as a criticism of Republican President George W. Bush and his vice president, Dick Cheney.

Halliburton was the largest U.S. military contractor in Iraq and Cheney its former CEO. He stepped down to re-enter politics and then sold his company stock -- for around $22 million, according to his financial filings -- when he joined Bush's campaign.

The firm was granted some lucrative contracts without the usual bidding process, which raised eyebrows. Both the company and administration denied any impropriety.

Halliburton was also in the headlines after the Deepwater Horizon rig explosion in 2010 triggered an environmental disaster in the Gulf of Mexico. It worked with oil giants BP and Transocean on the drilling technology and pleaded guilty to destroying evidence.

5 energy stocks to buy after the oil meltdown

Why the new ISIS currency is doomed