Gilead Sciences (GILD 0.91%) is a top HIV treatment company that has a bright future ahead. But in the past decade, it's been a bit of a bumpy ride for the business as its top line hasn't always been growing. Would investing in the stock 10 years ago have been a good move for you? Here's a closer look at how the stock has fared when compared to the markets during that stretch -- and whether it's a good buy today.

Gilead's business hasn't always been growing

In 2022, Gilead's top line was flat as a drop in COVID-related sales offset gains the company achieved in other areas of its business. But sales of $27.3 billion were still up 22% compared to 2019, before the pandemic.

And there's more growth on the horizon for Gilead as the company grows its oncology and HIV business, particularly with the Food and Drug Administration's recent approval of Sunlenca (lenacapavir). The twice-yearly injectable for HIV has the potential to become a blockbuster drug, with analysts projecting that it can bring in $1.5 billion in revenue at its peak.

But in previous years, revenue hasn't always been on a positive trajectory:

GILD Revenue (Annual) Chart

GILD Revenue (Annual) data by YCharts

In 2017, for instance, Gilead's revenue declined by 14% to $26.1 billion as the company saw double-digit declines in revenue for multiple products. For example, Harvoni, a treatment for hepatitis C, generated just $4.4 billion in sales that year, which was a year-over-year decline of 52% as demand fell across all markets.

Gilead's business is more diverse and in better shape today. But in the past its growth has been inconsistent.

The stock was trading at $48 in April 2013

At the start of April 2013, shares of Gilead were trading at around $48. Investing $10,000 in the healthcare stock then would have bought you approximately 208 shares of the business. Today, those shares would be worth around $17,500. That nets out to a profit of $7,500, or a return of 75%. When including its dividend, the stock's total returns are more impressive at 131%.

However, that still falls short of how well investors would have done simply from investing in the S&P 500. On a $10,000 investment, the broad index would have netted you a profit (including dividends) of more than $21,000 as it would be worth nearly $32,000 today.

GILD Total Return Level Chart

GILD Total Return Level data by YCharts

Gilead's struggles and lack of growth hurt the stock's returns, and it has only been within the past year that it has started to rally, shrinking the gap between its returns and those of the S&P 500.

Is Gilead a good buy today?

Moving forward, there's much more reason to be bullish around Gilead's business than there may have been four or five years ago. Oncology sales rose by 71% last year, and revenue growth from its products (excluding COVID-19 treatment Veklury) were up by 8%.

Although it hasn't always been a great buy, Gilead looks to be on a much better path now and is a stock that investors should consider picking up. Between its growth prospects and its attractive 3.6% dividend yield, there are multiple ways the stock can help you earn a good return and potentially beat the market.