International Business Machines has forecast full-year profit above market expectations after reporting surprise growth in quarterly revenue.

IBM was boosted by its high-margin cloud computing business, and the better than expected results sent its shares up more than 4%. 

Over the past few years, IBM's chief executive 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 in a $34 billion deal last year, its biggest acquisition so far, in a push to expand its subscription-based software business. 

Revenue from the cloud business rose 21% to $6.8 billion in the fourth quarter, its largest so far. 

The company forecast an adjusted profit of at least $13.35 per share for the year, compared with estimate of $13.29. 

IBM reported adjusted gross profit margin of nearly 52% for the quarter, a rise of 230 basis points, which was its largest in more than 10 years. 

The company had changed its reporting structure last year - its two biggest segments now are cloud and cognitive software, and global technology services. 

Revenue from the cloud and cognitive software segment, which includes Red Hat, rose 8.7% to $7.2 billion in the fourth quarter ended December 31. 

IBM has said that it would report only a portion of Red Hat's actual revenue for some quarters, while recording all its expenses as required by US accounting standards. 

The global technology services segment, which caters to some of the world's largest data centers, reported $6.9 billion of revenue, down 4.8% from the previous year. 

IBM recorded a marginal increase of 0.1% in overall revenue to $21.78 billion in the quarter, its first rise in six quarters. 

Analysts on average had expected a drop of nearly 1%, according to IBES data from Refinitiv. 

Rometty said IBM is positioned for sustained revenue growth in 2020. 

Excluding special items, it earned $4.71 per share, above analysts' expectation of $4.69.