Technology giant IBM (IBM), struggling to adjust to an ongoing slide in hardware sales, reported mixed first-quarter earnings on Wednesday, missing expectations on revenue but hitting forecasts for earnings.

The company’s stock was down nearly 6% in after-hours trading.

Revenue fell 4% from the year-ago quarter to $22.5 billion. Analysts polled by Thomson Reuters had predicted revenue of $22.9 billion.

IBM’s revenue has fallen from the year-ago period for eight consecutive quarters.

First-quarter net income was $2.4 billion, down 21% from a year ago. Operating net income was $2.6 billion versus $3.4 billion in the first quarter of 2013, a decrease of 22%.

IBM said the results include the impact of a charge of approximately $870 million for workforce rebalancing and a gain of nearly $100 million for the divestiture of the customer care outsourcing business.

“In the first quarter, we continued to take actions to transform parts of the business and to shift aggressively to our strategic growth areas including cloud, big data analytics, social, mobile and security," CEO Ginni Rometty said in a statement.

Revenue in IBM's systems-and-technology unit, which includes its hardware business, fell 23% in the first quarter, marking the tenth straight quarterly decline.

Gross margin widened to 46.9%, up 1.3 points.

First-quarter revenue for IBM American units were $9.6 billion, a decrease of 4% from 2013. Revenues from Europe/Middle East/Africa were $7.6 billion, up 4%. Asia-Pacific revenues fell 12% to $5.0 billion, the company said.

Revenues from the company's growth markets decreased 11%, while revenues in the so-called BRIC countries -- Brazil, Russia, India and China -- were down 11%.

Follow Dunstan Prial on Twitter @DunstanPrial