The company made the announcement Wednesday after the markets closed. Analysts had estimated the job cuts would be as high as 35,000.
The restructuring is expected to generate annualized savings in the range of $3 billion to $3.5 billion exiting fiscal year 2014.
"These initiatives build upon our recent organizational realignment, and will further streamline our operations, improve our processes, and remove complexity from our business," Meg Whitman, HP president and chief executive officer, said in a statement. "While some of these actions are difficult because they involve the loss of jobs, they are necessary to improve execution and to fund the long term health of the company."
HP said it plans to invest in research and development to drive innovation and differentiation across its core printing and personal systems businesses, as well as emerging areas.