Hewlett-Packard plans to cut nearly 27,000 jobs by the end of 2014 in a move designed to cut costs and streamline business, the company announced in a statement.

HP is planning to axe 8 percent of its workforce, which is expected to reduce annual costs by up to $3.5bn (£2.2bn), which the company plans to reinvest in the business.

The world's number one personal computer maker has nearly 350,000 people in its global workforce and has been struggling to keep its market share against the domination of smartphones and tablet computers.

The company employs nearly 20,000 people in the UK.

HP is planning to complete the layoffs within two years, mainly through early retirement to minimise the number of redundancies. The company indicated layoffs are expected to take place across every business in every region where it operates.

"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's chief executive Meg Whitman said.

"We are setting HP on a path to extend our global leadership and deliver the greatest value to customers and shareholders," she added.

HP said it would reinvest the savings in growth areas, such as cloud storage technology, to remain a leader in the technology space.

As part of the new development, Dr Mike Lynch, chief executive of the company's autonomy division, will be replaced by Bill Veghte, the company's chief strategy officer, following a "transition period", the company said.

Lynch's software company Autonomy, one of the UK's largest technology companies, was acquired by HP in 2011 for over $10bn.

HP posted a 31 percent fall in its Q2 profits to $1.6bn and a 3 percent reduction in revenue at $30.7bn, compared to the previous year. The numbers were above market expectations, which sent the stock rallying 11 percent higher on Wall Street.