What happened

Shares of silver and gold miner First Majestic Silver (AG 4.38%) advanced strongly on Aug. 4, rising just shy of 12% at one point and finishing the day with a 9.4% gain. The move higher was driven by two factors: Q2 results and rising precious metals prices.

So what

As a precious metals producer, First Majestic's top and bottom lines are driven by the price of silver and gold. Simplifying things, it makes the difference between its production costs and the prices for which it can sell what it produces. Both silver and gold were higher today, boosting investors' view of the companies that produce these metals. That was tailwind No. 1.

In addition to rising commodity prices, First Majestic also reported second-quarter 2022 results today. Although the company's adjusted loss was $0.02 per share, down materially from a profit of $0.05 per share in the prior-year period, there were a few material positives in the quarter. For example, production was higher by 20% year over year and up 7% sequentially from Q1.

Meanwhile, all-in sustaining costs (AISC) -- a measure of how much it costs to produce an ounce of metal accounting for the investment needed to maintain production -- were 3% higher year over year but down 5% sequentially from the first quarter. And management expects AISC to keep falling as the year progresses because it continues to work on cost-containment efforts and production is still ramping up at two mines. Rising production and falling costs is a very positive combination for profitability, assuming silver and gold prices remain strong.

Now what

Investors were clearly pleased by the combination of higher silver and gold prices and the company's expectations for rising production and falling costs. However, precious metals prices are volatile and prone to dramatic moves. So while the fundamental story from the quarterly report was decent, the stock will still trade at the whim of sentiment, which is usually driven by gold and silver prices.