Compaq Computer Corp., the world's largest maker of personal computers, said yesterday that it will buy Digital Equipment Corp. for $9.6 billion in the computer industry's largest-ever merger. The deal would create the second-largest computer company in the world, one that even giant International Business Machines Corp. will have to watch with care.

"It's been our stated goal to become one of the top three computer companies in the world," Compaq chief executive Eckhard Pfeiffer said at a news conference in New York.

The combined company will become the industry's newest giant, with combined annual revenue of $37 billion based on last year's sales. It will be second only to IBM, which had $78.5 billion in revenue last year. Hewlett-Packard Co. ranks third, with 1997 revenue of $35.5 billion from computer products and services.

At the heart of the Digital deal, analysts say, is Compaq's keen interest in moving beyond its preeminence in personal computers to build a strong presence in the lucrative corporate marketplace. To do that, Compaq needs a corps of experts who can advise companies on how to use the latest technology, including the sophisticated "server" computers that Compaq also makes.

"The services {division} is the jewel they're trying to pull out of Digital," said Frank Gens, a senior vice president at International Data Corp., a market research group in Framingham, Mass.

Compaq already is the third leg in one of the technology world's most powerful alliances, a partnership that began with Microsoft Corp., maker of the dominant personal computer operating system, and Intel Corp., whose chips run most of the world's PCs.

Microsoft, Intel and Compaq have fueled the explosive growth of the personal computer industry, putting PCs in the hands of millions of consumers and businesses. Compaq captured nearly 30 percent of the growth in PC sales last and shipped nearly 10 million personal computers, according to Dataquest Inc., an industry research firm.

But Compaq, Intel and Microsoft have set their sights on the more profitable -- and more demanding -- market of serving large companies, and they are tailoring their future software, chips and computers for that market. Microsoft is pushing its Windows NT operating system software, and Intel is developing its "IA-64" family of chips, starting with one it calls "Merced."

Compaq has used Microsoft software and, for the most part, Intel chips to achieve its top ranking in PC sales. But two years ago, company managers reorganized the firm to focus on corporate customers, said John Rose, a senior vice president at Compaq. Last year, Compaq spent $3 billion to buy Tandem Computers, a longtime maker of sophisticated "fault-tolerant" systems -- computers designed to be relatively crash-proof in critical applications.

By 2000, Rose said, Compaq managers want the company to pull in $50 billion in revenue, half of it by selling high-end computers such as servers and services to corporations, compared with about 37 percent of its revenue from such customers before the Digital deal was announced.

Analysts said the deal was not surprising. Compaq has long considered buying at least a portion of Digital, which, in turn, has struggled over the past few years to improve its bottom line.

In acquiring Digital, Compaq is taking on a complex organization and a markedly different corporate culture, industry experts point out. The deal, unanimously approved yesterday by both companies' boards, also must pass muster with U.S. antitrust regulators and the shareholders of both firms.

Yet if the merger is a success, the company that emerges will be an even stronger partner in the Microsoft-Intel alliance. Both Compaq and Digital were committed to supporting Windows NT before this deal, pointed out Nathan Myhrvold, Microsoft's chief scientist.

"DEC has organization and enterprise skills and Compaq has a heritage in the mass production world," he said. "NT is a product that straddles those two areas," he added, and the new firm will be well suited to propel it forward.

But corporate customers want more from their suppliers than the latest hardware and software; they want a corps of trained specialists who can make all the pieces work, and even after acquiring Tandem, Compaq was "nowhere near the player that DEC is" in that area, said Gens of IDC.

With the purchase of Digital, Compaq gains a company that not only is known for its server computers, but one that over the years has created a services division for large customers that ranks among the top 10 in the world, Gens said. Digital has a group of about 25,000 engineers and support staff around the world, compared with 8,000 for Compaq.

Digital's services division "has been a real moneymaker," said Tony Scott of A.T. Carney, an executive search organization, in Redwood Shores, Calif. Last quarter, for instance, services amounted to $1.5 billion of Digital's $3.3 billion in revenue. (For all of 1997, Digital had $13 billion in revenue, and $140.8 million in profit.)

But Compaq inherits more than a strong services group. Digital's researchers are known for creating such jewels as AltaVista, a powerful "engine" for searching the World Wide Web; the Alpha microprocessor, which routinely outstrips Intel's family of Pentium processors; and a promising chip called StrongARM, designed to be the brains of handheld electronic devices and possibly even the TV set-top boxes that promise to meld TVs and computers.

Although the technologies are promising, analysts said, many of those efforts have seemed to muddy Digital's core business and sap its profitability. Recently, Digital agreed to sell its chip businesses to Intel, although the deal is still awaiting government approval. Executives said Compaq, after it buys Digital, will continue to support Alpha.

Under terms of the deal, which the companies hope to complete in the second quarter, Digital shareholders will receive $30 in cash and about 0.945 share of Compaq stock for each share of Digital stock they own. Compaq plans to pay $4.8 billion in cash and issue 150 million shares of stock to finance the purchase. Based on Compaq's closing price of $31.75 Friday, the deal values Digital at just more than $60 per share, a nearly one-third premium to the company's $45.43 3/4 close Friday.

Yesterday, Digital stock jumped $10, to $55.43 3/4, while Compaq fell $2.75, to $29, both in composite trading on the New York Stock Exchange. COMPANIES IN PROFILE

Compaq Computer yesterday agreed to buy Digital Equipment for $9.6 billion in the biggest takeover ever in the computer industry. CAPTION:COMPAQ COMPUTER Business: Leading company in the design, manufacturing and marketing of personal computers. Established: 1982 Based: Houston Employees: 18,900 Sales: $24.6 billion Net income: $1.9 billion Yesterday's closing stock price: $29, down $2.75, on the New York Stock Exchange DIGITAL EQUIPMENT Leading supplier of networked computer systems, software and services. Established: 1957 Based: Maynard, Mass. Employees: 54,400 Sales: $13.0 billion Net income: $141 million Yesterday's closing stock price: $55.433/4, up $10, on the New York Stock Exchange NOTE: Data are for year ended Dec. 31, 1997 (Compaq) and June 30, 1997 (Digital). SOURCES: Reuters, companies, Value Line, industry reports CAPTION: CEO Eckhard Pfeiffer says Compaq's goal was to be in the top three.