International Business Machines Corp. reported a fifth sequential quarter of falling sales, with the company’s legacy information-technology business holding back Chief Executive Ginni Rometty’s efforts to revive growth through the $34 billion acquisition of software giant Red Hat.

IBM on Wednesday reported sales of $18.03 billion, below analysts expectations and trailing the $18.76 billion it posted in the year-prior period. Shares slumped 6% in after-hours trading.

The...