Pfizer (PFE 0.06%) has been a terrible investment over the past three years. Revenue and earnings have generally moved in the wrong direction, as the company has been unable to follow up on the success it achieved in the coronavirus market. The stock has declined by 50% over this period.

However, Pfizer's most recent earnings report was strong, and helped jolt the stock. Could that be the start of a solid run for the drugmaker? Let's find out.

Looking at Pfizer's second-quarter earnings

During the second quarter, several of Pfizer's products performed well. Consider its coronavirus business, which made a fortune several years ago. Revenue from this franchise has been somewhat inconsistent, but it made meaningful contributions to Pfizer's results for the quarter. Sales of its coronavirus vaccine Comirnaty came in at $381 million, 96% higher than the year-ago period, while Paxlovid, a medicine for COVID-19, posted revenue of $427 million, for a 70% year-over-year increase.

Meanwhile one of Pfizer's newer launches, Abrysvo, a vaccine for respiratory syncytial virus (RSV), is slowly gaining traction. It reported sales of $143 million for the quarter, more than double the amount in the same period last year.

Pharmacist talking to patient.

Image source: Getty Images.

Other good performers included Pfizer's anticoagulant Eliquis, which remains its top-selling product, and cancer drugs Xtandi and Padcev. Another is Vyndaqel (which it sells under a couple of other brand names), a therapy used to address heart problems in patients with a rare disease called transthyretin-mediated amyloidosis.

In addition, Pfizer continues to reduce expenses, and projects net cost savings of $4.5 billion by the end of this year. All these factors led to strong performances on the top and bottom lines for Pfizer. Total revenue increased by 10% year over year to $14.7 billion, while adjusted earnings per share were $0.78, 30% higher than the year-ago period.

Is Pfizer's stock a buy?

Though Pfizer's results were encouraging, it's worth pointing out a couple of challenges. First, the company's coronavirus franchise will continue to be hard to predict from one quarter to the next and from one year to the next. Though it made a meaningful contribution this time around, investors can't count on that happening consistently.

Second, some of the products that contributed to top-line growth in the second quarter will lose patent exclusivity within a few years, including Eliquis and Xtandi. Pfizer cannot rely on these products to drive strong results over the medium term.

Even so, there are good reasons to invest in Pfizer's shares today. One of them is the company's oncology pipeline. Pfizer has strengthened its presence in that area of the business in recent years, largely due to acquisitions. The company should achieve significant clinical and regulatory wins in oncology over the next few years, which will ultimately enable it to reduce its exposure to products such as Eliquis, Xtandi, Comirnaty, and Paxlovid.

Pfizer is also continuing to reduce expenses, and plans to decrease costs by a total of $7.2 billion by the end of 2027.

Furthermore, its newer products should also contribute. Abrysvo isn't the only one; the drugmaker earned approval for several brand-new medicines a couple of years ago. Though most aren't making meaningful contributions to its financial results yet, potential label expansions for some of them could change that. Abrysvo recently earned approval in Europe to help prevent lower respiratory tract disease caused by RSV in patients age 18 to 59 (it was previously approved for people age 60 and older). Additional indications of this type will help Pfizer's new product portfolio grow.

Lastly, the stock remains more than reasonably valued. Pfizer's recent forward price-to-earnings ratio was around 8.3, much lower than the healthcare industry's average of 15.9. At these levels, Pfizer looks attractive, especially when we consider the company's solid dividend program, which currently offers a juicy forward yield of 7%.

Investors shouldn't buy Pfizer's shares just because of its recent earnings beat. For those willing to stay the course, there might be considerable upside for the stock.