Neustar, the Sterling, Va.-based technology company that manages telephone numbers, has struck a $2.9 billion deal to be acquired by California ­private-equity firm Golden Gate Capital.

The deal will take the company private late next year after more than a decade on the public markets. It also reverses a planned spinoff that would have divided the company in half.

“While the spin was the right answer, it was nevertheless ripping apart an infrastructure, tearing apart a family, and somewhat distracting,” Neustar chief executive Lisa Hook said. “This allows us to stay together and really focus on pushing forward with product development, marketing and sales.”

Neustar started in Northern Virginia as a four-person business unit of Lockheed Martin before going off on its own in 1996. The company won a lucrative government contract to manage the database that allows people to keep their phone number after switching carriers. The seemingly simple idea entails staggeringly complex data management challenges, as the company processes millions of U.S. and Canadian phone numbers across thousands of carriers.

For two decades, the number-portability contract was the bedrock of Neustar’s business. But in recent years the company began to move into new lines of business through a combination of organic growth and acquisitions.

[Neustar is paying $450 million to re-invent itself as a marketing technology firm]

Neustar now manages certain Internet domain names, buying up the owners of popular Web addresses such as “.co” and “.biz” and country domains, such as “.au” for Australian sites. The company branched out into advanced technical services such as cybersecurity and digital marketing, including a partnership with Facebook designed to quantify the effectiveness of each dollar spent on advertising.

The shift accelerated under the leadership of Hook, a former AOL executive who took the helm at Neustar in 2010. Hook engineered a slew of acquisitions designed to bolster the company’s private-sector business, and the contract’s share of company revenue gradually fell from about 65 percent to less than half. Today, Neustar makes about $500 million a year from the number-portability contract and upward of $700 million from its other revenue sources.

Last year, the federal government said it would award the number-portability contract to a subsidiary of Swedish telecommunications conglomerate Ericsson, citing cost savings. Neustar has been trying to appeal the decision, but it remains highly likely that the company will lose a huge portion of its revenue when the contract lapses, a transfer that is expected to take place in 2018.

In June, striking a new strategic path, the company announced plans to split into two separate, publicly traded companies. The goal of the split, Hook said, was to get a better stock value for the fast-growing information services unit by divorcing it from the threatened number-portability business.

Not long after Neustar announced the split, representatives from Golden Gate Capital contacted the company about a potential acquisition. In less than six months, the sides arrived at a deal that paid public investors a 21 percent premium over Tuesday’s closing price, taking the firm private in a transaction that the companies valued at $2.9 billion.

Hook said that the company’s buyer “believes in the value of the company as a single entity,” and plans to keep its headquarters in the Washington area.

“As one of my employees said this morning, ‘We’re going to keep the family together,’ ” Hook said of the new direction.