HP Inc. reported sales that surpassed estimates on firmer demand for computers and printers that are helping drive profitability.

Revenue rose 3.6 percent percent to $12.7 billion in the fiscal first quarter, the Palo Alto, California-based company said Wednesday in a statement. Analysts on average projected $11.8 billion, according to data compiled by Bloomberg. The company also gave a forecast for profit in the current quarter that may top analysts’ estimates.

Chief Executive Officer Dion Weisler -- under pressure from shrinking markets for printers and computers -- is investing in the company’s products after reducing jobs and implementing other cost-cutting measures. HP, which split from Hewlett Packard Enterprise Co. more than a year ago, is benefiting from rising demand in the premium parts of its lineup, including high-end laptops. Revenue for personal systems, which includes the computer lines, increased 10 percent from a year earlier to $8.22 billion in the quarter ended Jan. 31.

“PC sales reflect HP’s strong product portfolio,” Shannon Cross, an analyst at Cross Research, said in an e-mail. “Overall, it appears that HP has gained its footing as a separate company. Management is very focused on cash flow and earnings with the idea that ever penny counts.”

HP Inc. shares climbed as much as 2.5 percent in extended trading after closing at $16.20 in New York. The stock has gained 9.2 percent this year.

The company reported first-quarter profit, before certain items, of 38 cents a share, beating analysts’ estimates of 37 cents. Net income from continuing operations was $611 million, or 36 cents a share, little changed from a year earlier.

“I have an increased confidence in our ability to deliver on our commitments,” Weisler said in a briefing. “We’re convinced that our best days lie ahead of us.”

Profit from continuing operations, excluding some items, will be 37 cents to 40 cents a share in the quarter ending in April, compared with the 38-cent average of analysts’  projections.

Consumer PCs

In the personal systems group, consumer sales rose 15 percent and commercial sales rose 7 percent in the first quarter. Notebook shipments climbed 12 percent, while desktop unit sales were unchanged.

The total market for personal computers showed some improvements in the last three months of 2016. Overall shipments of PCs fell 1.5 percent, a slimmer decline for an industry that’s still looking for growth after a multiyear slump, IDC said in January. Globally, HP was No. 2 with 21.7 percent market share, slightly behind leader China-based Lenovo Group Ltd., which had 22.4 percent.

“It’s basically finding these pockets of growth,” Chief Financial Officer Cathie Lesjak said in the briefing. “With the right cost structure -- which we have and are continuing to improve -- it gives us a lot of opportunity to go after what we call the heat in the market.”

The printing unit also fared better in the quarter. Printing revenue declined 3.4 percent compared to a drop of 8.2 percent in the previous quarter. Consumer printing unit sales performed better than the commercial business.

The company is making investments in the group to help bolster sales in various areas. In September, it agreed to buy Samsung Electronics Co.’s printer business for $1.05 billion, betting that it can grab share and generate income. HP has said the deal should close later this year.