SAN FRANCISCO — Hewlett-Packard Co. is cutting 27,000 jobs in an effort to recover from management missteps that hobbled the Silicon Valley pioneer as its rivals raced ahead with more innovative products and services.

The streamlining announced Wednesday represents HP's largest payroll purge in its 73-year history. About 8 percent of HP's nearly 350,000 employees will be gone by the time the overhaul is completed in October 2014.

The cuts come eight months after HP hired Meg Whitman as CEO to turn the company around.

The company expects to save $3 billion to $3.5 billion annually from the job cuts and other austerity measures.

HP said it will avoid as many layoffs as possible by offering early retirement packages. And word of the cut had leaked out in media reports late last week, so the news didn't come as a surprise.

Nevertheless, the sobering details overshadowed the release of HP's latest quarterly results. Although HP's earnings and revenue declined from a year ago, the numbers were better than analysts had projected. HP delivered another pleasant surprise by offering a forecast that raised hopes that HP may be poised to bounce back.

"While I wouldn't say we have turned the corner, we are making real progress," Whitman told analysts during a conference call.

Echoing comments she made three months ago, Whitman cautioned that "turning HP around is going to be a lot of hard work. It's going to take time. But we know what needs to be done."

Investors were pleased, although it wasn't clear whether their glee had more to do with the cost-cutting or the company's performance during its fiscal second quarter, which ended in April.

HP shares surged $1.97, or more than 9 percent, to $23.05 in Wednesday's extended trading. That's still about half their value before HP parted ways with Mark Hurd, a cost-costing specialist who stepped down in 2010 amid a scandal revolving around the nature of his relationship with a former actress who worked as an HP contractor. An investigation uncovered inaccurate expense reports.

The current troubles at HP have been traced both to Hurd, who cut research and development to boost profits, and his successor, Leo Apotheker, who didn't respond to the threat posed by a shift to computing on smartphones and tablets.

Whitman's plan calls for less bureaucracy so the company can respond more quickly to customer needs. She also wants to boost research and development to spur more innovation.

HP, which is based in Palo Alto, Calif., has been struggling to sell more personal computers and printers, partly because they aren't needed as much now that people are spending so much time surfing the Web on phones and tablets such as Apple Inc.'s iPad. The company's efforts to sell more business software and consulting services have been stymied by competition from the likes of IBM Corp. and Oracle Corp.

"Work force reductions are never easy," Whitman said Wednesday. "They adversely impact people's lives, but in this case, they are absolutely critical to the long-term health of the company. Our goal is simple: a better outcome for the customers at reduced cost for HP."

Whitman plans to funnel most of the savings from the job cuts into product development, with an emphasis on three areas: software services delivered online, a concept known as "cloud computing"; data storage and analysis; and computer security.

Some of the extra cash will go toward boosting HP's earnings, too.

HP's workforce has undergone several other reorganizations during the past decade. Two of the biggest occurred during Hurd's regime. HP announced 14,500 job cuts in 2005 in one of his first big acts as CEO. HP also announced 24,600 cuts in 2008 after buying technology consulting service EDS for $13.9 billion.

HP did not say where the latest cuts would come from. It is combining its printer and PC divisions, which could reduce some overhead.

In related moves, Whitman is changing the leadership at HP's recently acquired Autonomy division, which makes software that finds and analyzes data within companies and government agencies.

Bill Veghte, HP's chief strategy officer, is replacing Autonomy founder Mike Lynch in an effort to boost the division's financial performance. The shake-up is likely to amplify investor concern about whether HP blundered last year when it paid $11 billion for Autonomy. Apotheker announced the deal in August, just a month before he was fired.

Whitman told analysts she still believes the Autonomy acquisition was smart.

The company earned $1.6 billion, or 80 cents per share, in February through April. That's 31 percent less than the $2.3 billion, or $1.05 per share, it earned a year earlier.

If not for several items unrelated to HP's ongoing business, the company said it would have earned 98 cents per share. That adjusted earnings figure topped the average estimate of 91 cents per share among analysts surveyed by FactSet.

Revenue fell 3 percent from last year to $30.7 billion. That was about $800 million above analysts' average projection.

To pay for severance and other restructuring costs, HP expects to take a pre-tax charge of about $1.7 billion in the current fiscal year, which ends in October. About $1 billon of those charges will come in the current quarter ending in July. HP expects to take charges of an additional $1.8 billion through fiscal 2014.

The company also expects to register a charge of $1.2 billion to account for the declining value of the Compaq computer brand. HP bought Compaq a decade ago in a deal that many shareholders, including the son of a company founder William Hewlett, tried to block.

Related on HuffPost: