2022 has been a choppy year for equity markets as inflation concerns and rising interest rates clash with ongoing supply chain challenges and geopolitical tensions. But one industry has been uniquely insulated from the broader market sell-off -- oil and gas.

A mismatch in global demand and supply of crude oil and natural gas, thanks to years of underinvestment in oil exploration and production, has led to tight supply and higher prices. The market expects oil and gas companies to profit from higher oil and gas prices bidding up the S&P Energy Select Sector Index by nearly 39% this year, even as the S&P 500, Dow Jones Industrial Average, and the Nasdaq Composite are all down for the year

However, some folks may not want to directly invest in oil and gas companies since their valuations are already looking expensive. Instead, it may be a better idea to invest in an industrial company, like Caterpillar (CAT -0.55%), that has exposure to oil and gas while its overall performance doesn't hinge on that industry booming or busting. Meanwhile, defense giant Lockheed Martin (LMT 1.71%) has a multi-year backlog of projects with the U.S. government and its allies that give it steady revenue streams independent of the war in Europe. Here's what makes each dividend stock a great buy now.

Sparks fly as an industrial worker uses a circular saw.

Image source: Getty Images.

Caterpillar's business is thriving

Caterpillar is known for its construction business. But the company makes more money from the equipment it provides for the oil and gas, and mining industries than it does for construction. However, unlike a typical upstream oil exploration and production company, or a refinery, Caterpillar's business is immune to the actual volatility in oil and natural gas prices.

Rather, the industrial equipment manufacturer fills a support role and generates a relatively stable profit even during times of low investment. For example, a look at Caterpillar's 20-year net income chart shows that the company's business is cyclical but it routinely churns out a hefty profit even during recessions. 

CAT Net Income (Annual) Chart
Data by YCharts.

While Caterpillar did say in its fourth-quarter 2021 conference call that it expects its oil and gas customers to keep a lid on spending, it still expects demand for its engines and aftermarket services to grow. 

Just as consumers are inclined to make discretionary purchases, such as a new car or an expensive trip, when wages rise and unemployment edges down in a booming economy, a similar relationship exists for companies like Caterpillar. The only difference is that its customers are businesses and not individual consumers. This means Caterpillar's business is cyclical by nature. Investing in the business tends to decline during economic contractions as its customers batten down the hatches on spending, in order to preserve liquidity.

CAT Chart
Data by YCharts.

For investors who are optimistic about an ongoing imbalance between demand and supply in the oil and gas industry and resource industries, Caterpillar could be a great stock to buy. Capital preservation continues to be the maxim in oil and gas right now. But if companies do decide to increase investments, then Caterpillar's business would probably be one of the first to benefit. That is, Caterpillar tends to be a leading indicator for the health of the industries it serves. If Caterpillar's dealers begin carrying more Caterpillar equipment in their inventories, that could mean they expect higher demand from their customers. By monitoring Caterpillar's business and its dealer inventories, investors can gauge whether or not oil and gas investment is rising. If investment begins to rise, it will benefit Caterpillar but could lead to lower oil and gas prices. 

Despite the short-term ebbs and flows in its business, Caterpillar has proven over the past few decades that its investors can count on a stable and growing dividend. Caterpillar is a Dividend Aristocrat that has paid and raised its dividend for 27 consecutive years.

A defense giant with one of the most reliable dividends out there

Russia's advance into Ukraine has generated attention for defense stocks that play an instrumental role in the U.S. military-industrial complex. Lockheed Martin is a leader in military aircraft like fighter planes and helicopters, as well as missile systems, satellites, software, and other products and support systems. On March 14, Germany said it'd 35 Lockheed Martin F-35 fighter jets, which was a dramatic shift in the country's prior position to buy older, less expensive fighters. 

For the record, Lockheed Martin and fellow U.S. defense contractor Raytheon Technologies make Javelin anti-tank missiles that are being used in thwarting the advance of the Russian army through Ukraine.

Investing in Lockheed Martin stock as a play on the Russia-Ukraine conflict is the wrong approach. Rather, investors should view the conflict as an example of Lockheed Martin's technological prowess and the relevance of its products when tensions rise. If anything, the conflict reaffirms Lockheed's role in U.S. defense spending and adds even more security to the long-term thesis of Lockheed as a reliable defense stock.

Over the past five years, Lockheed Martin has steadily grown its sales and earnings, which both reached all-time highs in 2021. It has also grown its free cash flow, which it has used to support its growing dividend.

LMT Revenue (Annual) Chart
Data by YCharts.

A strong underlying business that is resistant to economic cycles makes for a great dividend stock. Lockheed Martin has a dividend yield of 2.6%.

Caterpillar and Lockheed are not expensive stocks

Despite trading within striking distance of all-time highs, both Caterpillar and Lockheed Martin stock remain reasonably valued. In fact, both companies have low price-to-earnings ratios that are right around their five-year median levels, a sign that earnings growth is supporting rises in their respective stock prices.

CAT PE Ratio Chart
Data by YCharts.

Caterpillar and Lockheed Martin stand out as two companies that are benefiting from short-term trends but also have compelling long-term investment theses.