SAN FRANCISCO — Hewlett-Packard Co. is buying Electronic Data Systems Corp. for $12.6 billion in a deal that will create the second largest technology services provider behind IBM.

Under the terms announced Tuesday, Palo Alto-based HP will pay $25 per share in cash for EDS, which pioneered the concept of running computer systems and providing other high-tech help for large companies and government agencies.

It's a field dominated by IBM Corp., which generated $54 billion in revenue from technology services last year. HP's technology services revenue will more than double to more than $38 billion with the addition of EDS, which had $22 billion in revenue last year.

The deal is expected to close during the second half of last year and begin to boost HP's profit in its fiscal year ending in October 2010.

Once the marriage is completed, HP estimates it will have about a 7 percent share of the technology service market compared with IBM's 10 percent share. The deal will enable HP to leapfrog Fujitsu and Accenture in the niche.

To make sure the EDS takeover pays off, HP indicated it will make significant layoffs as it eliminates overlapping jobs and other expenses. In Tuesday conference calls with media and analysts, HP Chief Executive Mark Hurd and EDS CEO Ronald Rittenmeyer declined to estimate how many workers might lose their jobs.

"There are obviously going to be some changes," said Rittenmeyer, who will run the combined technology services unit and report directly to Hurd.

The combined services business would have 210,000 employees and operations in more than 80 countries. It will retain the EDS brand and EDS' Plano, Texas headquarters.

Hurd hailed the EDS deal as "compelling."

But analysts sounded less sure on Tuesday's conference call as they repeatedly grilled Hurd why he was willing to pay so much for EDS, given that the company's stock price had fallen by about 30 percent over the past year before news of the deal leaked out late Monday.

Some analysts expressed concern that EDS will become a drag on HP's revenue growth while others indicated they believed the company would have been better off spending its money buying an assortment of smaller software makers.

Hurd repeatedly brushed aside those misgivings in separate calls with analysts and reporters Tuesday, predicting HP and EDS will be able to create the "best services company on planet Earth, delighting customers in everything we do."

HP said the EDS acquisition had an "enterprise value" of $13.9 billion and didn't immediately explain how what that figure included. But based on 502.6 million EDS shares outstanding as of April 25, the acquisition would be worth $12.6 billion.

Either way, it will mark HP's largest purchase since it bought Compaq Computer Corp. for $19 billion six years ago. That acquisition paved the way for HP to supplant Dell Inc. as the world's largest PC maker.

The agreed price of $25 was nearly a 25 percent premium to Friday's closing price for EDS. The companies said Monday they were in talks. In morning trading Tuesday, EDS shares rose 35 cents to $24.43 while HP lost $2.83, or 6 percent, to $44.

Buying EDS gives more tools to challenge IBM in the lucrative technology services field. HP already has replaced IBM as the world's largest technology company, based on revenue.

The demand for data management and technology consulting services has steadily grown during the past two decades as the automation of corporate America and the rise of the Internet prompted more businesses to hire contractors to help run their computer software and hardware.

In one of its biggest previous attempts to expand its technology services, HP attempted to buy PricewaterhouseCoopers' consulting division in 2000. IBM wound up buying the unit instead.

HP has been on a roll since it hired Hurd as chief executive three years ago. Propelled by earnings growth that has consistently exceeded analyst expectations, the company's stock price has more than doubled since Hurd's arrival.

The trend continued in HP's latest quarter ended in May. In preliminary report released Tuesday, HP said it earned 80 cents per share on revenue of $28.3 billion in the period, up from 65 cents per share on revenue of $25.5 billion at the same time last year.

If not for one-time charges for previous acquisitions, HP said it would have made 87 cents per share — three cents above the average estimate among analysts polled by Thomson Financial.

As in many corporate marriages, cultural clashes between HP and EDS could ruin the union, said AMR Research analyst Dana Stiffler. "Palo Alto versus Plano wrangling will destroy any short-medium term benefit unless there's a strong integration roadmap," she predicted.

EDS has been linked with possible deals previously, including a reported interest by Deutsche Telekom late last year and Dell before that. No suitors ever confirmed reports that they were talking.

Former IBM salesman H. Ross Perot started EDS in 1962 to help run other companies' computer systems — a specialty generally known as information-technology or IT services.

Perot sold EDS to General Motors Corp. for $2.5 billion in 1984 and eventually became so disillusioned with how that deal worked out that he sold his remaining EDS shares to the automaker so he could start a new rival service bearing his name.

An outspoken billionaire, Perot became even more famous for running for U.S. president in 1992 and 1996. GM spun off EDS as an independent company in 1996 and remained its largest customer.

EDS was riding high at the start of the decade, despite the dot-com bubble's bursting. But in late 2002, earnings shortfalls led to investor lawsuits, a Securities and Exchange Commission investigation, the ouster of the chief executive, and a sharp drop in the stock price.

The company lost $1.7 billion in 2003 but gradually righted itself under CEO Michael Jordan, a retired CBS and Westinghouse CEO. He fixed some money-losing contracts, including a multibillion-dollar deal to build a communications network for the Navy and Marine Corps, and began cutting costs by sending thousands of jobs to low-cost countries such as India.

Although he hasn't seen any signs to suggest EDS has been looking for a buyer, Jefferies & Co. analyst Joseph Vafi said the company's board might have decided a sale would create a quicker payoff for shareholders than continuing to try to grow the company in the highly competitive technology services industry.

AP Business Writers Jennifer Malloy in New York, David Koenig in Dallas and Dibya Sarkar in Washington, D.C., contributed to this report.