Lockheed Martin (LMT -1.26%) shareholders have enjoyed a good run. The stock is up 85% over the past five years, besting the S&P 500 by 20 percentage points.

The company, the world's largest pure-play defense contractor, has a portfolio that is the envy of the industry. It is also likely coming up on Washington budgetary headwinds after years of Pentagon spending growth.

Are the best days over for the stock, or is now a good time to climb aboard? Here's a look at Lockheed Martin's outlook to determine whether the stock is a buy today.

A well-stocked arsenal

Lockheed Martin is best known as the maker of the F-35 Joint Strike Fighter, a trillion-dollar program for Lockheed and its subcontractors that provides a steady stream of revenue and profits for the company.

The F-35 is important, but Lockheed Martin is no one-trick pony. The company is a leader in hypersonics, missiles that travel five times the speed of sound. That's an area of concern for the Pentagon, due to fears that the U.S. lags China and Russia in next-generation missiles, and should be a reliable source for new contracts.

A Lockheed Martin F-22 in flight.

Image source: Lockheed Martin.

Lockheed Martin also has a large missile defense business, including manufacturing the THAAD anti-ballistic system deployed to counter North Korean threats, and is a major space and intelligence contractor. Its helicopter division is involved in two massive competitions that will reshape the Army's aerial portfolio.

Overall, Lockheed Martin ended the second quarter with a backlog of orders totaling $150 billion. It also has new avenues available in pursuit of growth, including the possibility of M&A and the potential to venture into 5G networking.

Risks on the horizon

Lockheed Martin shares have had a great five-year run, but the stock is flat for 2020. It's an election year, which usually creates turbulence for defense stocks. And with COVID-19 straining government coffers, we are likely heading into a difficult Pentagon budgeting environment, which would threaten growth rates throughout the industry.

As mentioned above, Lockheed's portfolio should hold up better than most should the Pentagon be forced to make difficult choices, but tight budgets tend to lead to delayed appropriations and pushed back deadlines. Lockheed Martin's backlog provides assurance that there will be cash flowing in no matter what happens in Washington, but it can't guarantee growth.

Lockheed Martin also has no prime contractor exposure to the Pentagon's planned $500 billion refresh of its nuclear arsenal, the government's top military priority and one that will soak up a lot of funding in the years to come.

There are also potential threats to some of Lockheed's top franchises. For example, we found out earlier this month the Air Force secretly built its next fighter jet. We don't know much about the highly classified project -- it is possible Lockheed Martin is the government's partner on the jet -- but if the plane lives up to its initial hype, it could affect long-term F-35 sales.

Is Lockheed Martin a buy?

Lockheed is a safe haven in what could be a turbulent market for defense stocks in the years to come. The company's portfolio leaves it insulated from the full impact of potential budget cuts, and its backlog provides assurance that future revenue targets will be achieved. The company also offers a decent 2.4% dividend yield for those willing to wait out whatever lies ahead.

But given the potential headwinds, it is hard to imagine Lockheed Martin shares enjoying another five years as good as the last five. And there are other defense stocks I believe have the potential to run higher in the quarters to come.

Lockheed Martin is a great company, and I'm holding onto my shares. But it is not a stock I'm buying right now.