International Business Machines Corp. (NYSE: IBM), the No. 2 computer company, is expected to report slightly lower third-quarter revenue Tuesday, but earnings are expected to rise at least 5 percent.

The “secret sauce” in a period of lower demand for all manner of hardware, as its bigger rival, Hewlett-Packard Co. (NYSE: HPQ), has found, is to rely ever more on software and services, which yield higher margins than product sales.

Unlike HP, IBM, of Armonk, N.Y., no longer has exposure to the consumer sector, having exited both the PC and printer lines years ago.

Virginia Rometty, CEO as well as chairman since Oct. 1, has promised that IBM would keep humming, despite weakness expected in Europe.

Analysts polled by Thomson Reuters forecast that IBM’s earnings will increase to $4.16 billion, or $3.61 a share, from last year’s $3.95 billion, or $3.28 a share.

Revenue is expected to ease about 3 percent to $25.36 billion from $26.16 billion a year ago.

Even before last week’s announcement that it would team up with AT&T Inc. (NYSE: T), the No. 1 telecommunications carrier, of Dallas, to offer a joint service for cloud computing next year, IBM has been taking steps to offer more all-in-one products to clients.

The third quarter will be the first for which the company may see results from its PureSystems program, which seeks to tailor IBM hardware and software to whatever services customers already have.

Investors, including IBM’s biggest outsider, Warren E. Buffett’s Berkshire Hathaway (NYSE: BRK/A), have been pleased by results so far this year. IBM shares have gained nearly 14 percent and trade very close to their 52-week high of $209.40.

They closed Monday at $208.93, up $1.13.

By contrast, shares of HP, of Palo Alto, Calif., have fallen nearly 50 percent this year and are trading near their 52-week low of $14.02, especially after CEO Margaret (Meg) Whitman warned two weeks ago it has years of fine-tuning ahead.

“We believe the company is well-positioned to weather any economic storms that may arise, given its diversity,” Dylan Cathers, analyst with Standard & Poor’s, said of IBM.

Aside from good performance, IBM remains committed to big share buybacks, which is something Buffett anticipated when he announced he’d bought in a year ago.

Buffett wrote his investors that he was counting on IBM’s buyback to keep profits flowing, as it buys more shares, keeps boosting dividends and adds to investors’ total return.

IBM directors said they’d added $7 billion to buybacks in April, when they also boosted the quarterly dividend 13 percent to 85 cents a share.

S&P's Cathers is among 12 analysts with “buy” recommendations for IBM. His price target is $227.

Ten more analysts have “holds,” and no analysts have “sell” recommendations on IBM shares.