The commodities market has been tough for investors the last few years. Producers built up too much capacity during the boom times, which caused prices to crash when demand growth didn't meet expectations. That said, some commodity producers are better positioned than their peers to handle these lower prices, which allows them to thrive in the current environment. Three of these top-tier commodity stocks are Terra Nitrogen Company (NYSE:TNH), ArcelorMittal (NYSE:MT), and EOG Resources (NYSE:EOG). Read on to see why we think these are great buys in July.

Can handle the worst the fertilizer market throws at it

Tyler Crowe (Terra Nitrogen Company LP): The market for nitrogen fertilizers has been absolutely miserable for years. As with so many other commodities, nitrogen fertilizers are feeling the hangover effects from the Chinese commodity boom at the beginning of this decade. So much excess production was built in anticipation of growing demand that the market is flooded today. Prices are so low today that most fertilizer producers are losing money hand over fist. That isn't the case with Terra Nitrogen, though.

Compass with needle pointing to the word "opportunity."

Image source: Getty Images.

Terra Nitrogen has one of the best advantages out there for nitrogen fertilizer producers. It uses domestic natural gas as a feedstock and is located in the heart of America's corn belt. The former is an advantage because U.S. natural-gas-based fertilizer is the lowest cost source of fertilizer in the global market today. Also, close proximity to end markets in the U.S. means lower transportation costs, which gives each ton sold a slight premium to imported fertilizers.

Add those competitive advantages to a company with low overhead and no debt, and you get a company still producing high margins in this low-commodity-price market. Last quarter, Terra Nitrogen's net income margin was a whopping 35% despite fertilizer prices hitting 13-year lows.

Yeah, the market is in the dumps, but Terra Nitrogen can make an awful lot of lemonade from the lemons the market has given it. Today, the stock trades at its lowest price to tangible book ratio in over a decade, and has a dividend yield of 7.5%. You don't even have to wait for a commodity price bump with this stock. Terra Nitrogen is a stock you should seriously consider right now.

Playing both sides of the commodities game

Jason Hall (ArcelorMittal): One of the challenges with investing in resource companies is that very often, the price of the commodity the company focuses on is the key driver behind the bottom line, and if you invest at the wrong time in that commodity's price cycle, you can quickly see your investment lose value. This is one of the reasons why I'm a fan of a company like ArcelorMittal. Not only is it one of the world's biggest producers of iron -- the raw material that's the main ingredient in steel -- it's also one of the world's biggest steelmakers. This has the company in a solid position both to benefit from higher commodity prices, and to feel less downside pain when commodities fall.

ArcelorMittal is also geographically diverse, with iron mines in North America, South America, and Europe, and steel production in Europe, every North American country, South America, Asia, and Africa. There is some risk for the company, with recent tariffs that could affect the profits of some of its sales to the U.S., but I think the risk is overstated, as the company should be able to shift production to mitigate the impact of tariffs.

Furthermore, steel demand is on a track of global growth, while ArcelorMittal is a stronger, less-leveraged company than it was a few years ago. The company has paid down billions in debt, while also improving its operating structure. Over the past year, cash flows are up, free cash flow has turned positive, and earnings are up.

ArcelorMittal is an excellent way to gain some commodity exposure, while also gaining some mitigating factors through its steel operations.

Hot steel on a conveyor in a steel mill

Image source: Getty Images.

Thriving at lower oil prices with a potential catalyst on the horizon

Matt DiLallo (EOG Resources): Oil hasn't been the steady performer that investors expected it would be this year. By the close of the first half, crude had fallen by double digits for the year after slumping into the mid-$40s. That's a bit too low for most producers to thrive -- to fuel their growth plans, many need oil prices in the mid-$50s.

That said, one oil stock that can do just fine on $40 oil is EOG Resources. That's because the company has used a combination of innovations, technical advances, and efficiency gains to get its well costs down and productivity up. The company now has a vast inventory of future premium drilling locations that can earn a 30% return at $40 oil, so it can grow oil output rapidly even at lower prices. For example, at $50 crude, EOG Resources can expand its oil production by a 15% annual rate through 2020 while living within cash flow.

That low-cost growth aside, there are two other reasons why investors should consider buying EOG Resources stock this July. First of all, its shares are down more than 10% on the year, despite reporting exceptional results in the first quarter. Second, the company will likely provide details on its exploration program in the upcoming quarter, which could be a major catalyst. Last year, for example, it announced a 75% increase in its premium resource potential, while it bumped the estimates for its Bakken Shale resource potential up to a billion barrels of oil equivalent in 2015. Another year of applying new techniques and innovations will likely lead the company to unveil that it has substantially more low-cost oil under its acreage position than previously thought. With the company on deck to release that report on Aug. 2, investors might want to consider scooping up this top-tier oil stock in July while it's still on sale.

Jason Hall owns shares of ArcelorMittal. Matt DiLallo has no position in any stocks mentioned. Tyler Crowe owns shares of Terra Nitrogen. The Motley Fool owns shares of EOG Resources. The Motley Fool has a disclosure policy.