What: Shares of tobacco giant Altria Group Inc (NYSE:MO) were gaining last month, finishing up 11%, according to data from S&P Capital IQ. A combination of an analyst upgrade, an e-cigarette deal with Philip Morris, and a strong earnings report at the end of the month helped lift the stock. 

MO Chart

MO data by YCharts

So what: The gains started on July 6 as the stock gained 6% in two days with the help of research firm CSLA, which upgraded the Marlboro parent from underperform to outperform, though the justification for the ratings increase was not clear.

On July 16, the stock gained another 3.5%, and continued to move higher afterward as the company announced an expansion of its e-cigarette deal with Philip Morris, the now-international company Altria was separated from in 2008. In the past, the two had agreed to sell each other's e-cigarette brands in their respective territories -- Philip Morris internationally and Altria domestically -- and now the two leading cigarette-makers have entered into a research, development, and technology-sharing agreement that will enhance development of the next generation of e-cigarettes. E-cigs are seen as an important growth driver in the industry as consumption of smoking tobacco is generally declining. 

Finally, the company closed out the quarter with a better-than expected earnings report, though the market's response was mixed as management expects earnings growth to slow in the second half of the year. Adjusted earnings per share increased 14% in the quarter to $0.74, and as a result management raised its full-year guidance to $2.76 to $2.81, representing growth of 7.5% to 9.5%.

Now what: July was a kind month to tobacco stocks in general, as rivals Reynolds American and British American Tobacco also posted double-digit percentage gains, and Philip Morris saw a gain of 7%. Rising prices for cigarettes helped lift all competitors, and the consolidation resulting from Reynolds American's acquisition of Lorillard should benefit the industry's overall profitability. Both volume and prices for Altria increased in the quarter, helping operating margins in its key smokeable products category improve 330 basis points to 47.5%. 

With a stronger domestic economy and low gas prices supporting increased discretionary purchasing of cigarettes, Altria shares should remain strong, and with a 3.9% dividend yield it should remain a good bet for income investors.