Analysts surveyed by Thomson Reuters had projected that the company would post earnings of $5.25 a share on $29.1 billion in revenue. Shares rose 3.6% in after-hours trading.

IBM's businesses include software and hardware development, along with consulting and IT services. With its vast size and global footprint, investors tend to view the company's earnings as indicative of overall corporate technology spending and demand.

The company is in the process of shifting to "higher-value businesses," including analytics and cloud computing, CEO Ginni Rometty said in a statement Tuesday.

IBM reported a 3% gain in software sales for the quarter, which helped offset declines in its services business.

The company appears to be feeling the effects of the slowdown in Europe, with revenue from the region down 5%. Sales in the Americas were flat, while Asia-Pacific revenues climbed 4%.

Overall, sales slipped 1% versus a year ago, through profits reached record levels, up 10%. For 2013, the company said it expects earnings of at least $16.70 a share, ahead of the analyst projection of $16.63.