Jan 21 (Reuters) – International Business Machines Corp on Tuesday reported a surprise rise in revenue, its first in six quarters, benefiting from its high-margin cloud computing business.

Revenue from the cloud business, which is crucial as IBM pivots away from its established businesses including mainframe servers, rose 21% to $6.8 billion in the fourth quarter ended Dec. 31.

Over the past few years, Chief Executive Officer Ginni Rometty has been trying to shift the company’s focus to the cloud through acquisitions and also by selling some of IBM’s legacy businesses.

IBM bought Linux maker Red Hat Inc in a $34 billion deal last year, its biggest acquisition so far, in a push to expand its subscription-based software business and counter falling software sales and declining demand for mainframe servers.

IBM recorded a marginal rise of 0.1% in revenue to $21.78 billion in the quarter, compared with a drop of nearly 1% predicted by analysts on average, according to IBES data from Refinitiv.

IBM’s net income rose to $3.67 billion, or $4.11 per share, from $1.95 billion, or $2.15 per share, a year earlier, when it took a charge of $1.9 billion related to the U.S. tax overhaul.

Excluding special items, the company earned $4.71 per share, above analysts’ expectation of $4.69. (Reporting by Munsif Vengattil in Bengaluru; Editing by Maju Samuel)