HP also announced a quarterly revenue of $8.76 billion, beating analyst's expectations of $8.28 billion.
The company's year-to-year growth was 14%.
Bloomberg reported that analyst Katy Huberty wrote a note for Morgan Stanley about HP's outlook. The gains offered greater confidence in the outlook of the company for the second half of the year.
Morgan Stanley rated HP as an equal-weight, and raised the price target to $28.
HP's outlook also increased, going to $3.7 billion from $3 billion.
The company has also announced that longtime CFO, Cathie Lesjack will be retiring in early 2019. The role of CFO will go to Steve Fieler on July 1.
HP's shares were up 4% when the market closed on Wednesday.