SAN FRANCISCO – In a dramatic reshuffling, Hewlett-Packard Co. said Thursday that it will end its tablet computer and smartphone products and may sell or spin off its PC division, bowing out of the consumer businesses.

It’s one of the most dramatic makeovers in the company’s 72-year history and signals new CEO Leo Apotheker’s most transparent move to date to make HP look more like longtime rival IBM Corp.

A decade ago, HP emerged from a bitter fight to spend more than $24 billion on Compaq Computer, setting the stage for HP to become the world’s No. 1 maker of personal computers. Now, three CEOs later, HP is changing course — hard.

The PC division is HP’s biggest revenue generator but least profitable division. The move has long been rumored, but just six months ago HP dismissed reports of the possibility as “irresponsible reporting.”

More striking is that HP plans to shutter its smartphone and tablet business just two years after spending $1.8 billion on smartphone maker Palm, which gave HP the webOS software that has been praised by critics but largely ignored by consumers.

It is here that HP was the victim of the Apple and Google juggernauts, as iPads and iPhones and smartphones running Google’s Android software have been hot sellers, while HP devices have languished.

HP also announced that it is in talks to buy Autonomy Corp., a business software maker. Earlier, The Wall Street Journal and Bloomberg News had reported that HP planned to buy Autonomy for $10 billion.

The decision to buy Autonomy also marks a change of course for HP, one that makes HP’s trajectory look remarkably similar to rival IBM’s nearly a decade ago.

IBM, a key player in building the PC market in the 1980s, sold its PC business in 2004 to focus on software and services, which aren’t as labor- or component-intensive as building computer hardware.

HP reported an increase in its third-quarter net income on Thursday, but gave a lower-than-expected outlook for the current quarter and cut its revenue outlook for the year.