International Business Machines posted profit margins that fell short of Wall Street expectations last night, a sign that its reinvention was taking time. 

Shares of the technology company fell 6% in after-hours trade despite it reporting the second quarter of revenue growth after a near six-year streak of declines. 

IBM has in recent years shifted its focus to higher-margin businesses such as cloud computing, cybersecurity and data analytics, to counter a slowdown in its legacy hardware and software businesses.

But the move is not going as fast as some shareholders had hoped. 

While IBM's revenue and profit beat expectations, the company's adjusted gross profit margin fell to 43.7% from 44.5% a year earlier. 

The company said the decline in gross margin was mostly due to "significant" one-time charges. 

IBM's chief financial officer James Kavanaugh said the company cut costs and took a $610m charge in the first quarter, though he did not give details. 

This announcement follows expectations of layoffs as IBM, under its chief executive Ginni Rometty, tries to offset declines from its legacy businesses. 

The company said it had a tax benefit of $810m, due to changes in the US tax law.

In addition, IBM said it continues to expect full-year adjusted earnings per share of at least $13.80, while analysts were expecting more, with the consensus at $13.83, according to Thomson Reuters I/B/E/S. 

IBM's revenue grew 5% to $19.07 billion in the quarter with 65% growth in sales from security services. Cloud revenue grew 25%. 

Net profit fell to $1.68 billion, or $1.81 per share, in the first quarter ended March 31, from $1.75 billion, or $1.85 per share, a year earlier. 

Excluding items, the company earned $2.45 per share, beating the analyst average estimate of $2.42. 

"We feel very comfortable as we enter the second quarter and the remainder of the year that we can actually deliver moving forward," Kavanaugh said.