Altria Group said Friday it has agreed to buy a 45 percent stake in leading cannabinoid company Cronos Group for about $1.8 billion, a sign of the new world in which the tobacco company must compete.

Altria is also weighing an investment in e-cigarette company Juul, CNBC has reported. Those talks could be completed by year-end, a person familiar with the situation tells CNBC.

Sales of cigarettes have slowed and its customers have either turned to other recreational products — like cannabis and e-cigarettes — or are threatening to do so. Those industries, though, are in need of expertise to navigate regulatory hurdles and capital to invest in their company.

"The proceeds from Altria's investment will enable us to more quickly expand our global infrastructure and distribution footprint, while also increasing investments in R&D and brands that resonate with our consumer," Cronos CEO Mike Gorenstein said in a statement.

It also helps "make sure we're getting in front of regulators," Gorenstein told CNBC on Friday.

Talks between Cronos and Altria have been ongoing for more than a month, people familiar with the situation told CNBC. Altria is one of several parties with which Cronos considered partnering, they added.

Altria's expertise with vaping products appealed to Cronos, which sees opportunity customizing vaporizers for cannabis, Gorenstein said.

As part of the deal, Altria has a warrant that would allow it to increase its stake in Cronos to about 55 percent at a price of $19 per share. It allows Cronos the flexibility to take investments from other companies such as, for example, a big food company.

Cronos is headquartered in Toronto, where cannabis has been nationally legal since October. It has no U.S. operations, where the industry remains illegal at a federal level but legal in 33 states and the District of Columbia.

Altria, meantime, sells the vast amount of its tobacco in the U.S. Its established U.S. presence should, therefore, serve to benefit Cronos, when or if cannabis is legalized federally. Altria does have an affiliate, National Smokeless Tobacco Company, that operates in Canada.

The deal is the latest in a flurry of conversations that have taken place across the consumer industry, where the threat of cannabis growth looms large over established, growth-starved industries spanning tobacco, soda and beer. No longer known just for its smoked product, cannabis has evolved to offer products for health, wellness, sleep and socializing.

With so much still uncertain, including who the industry winners will be, companies are still moving cautiously. For several, this includes stakes rather than initial full acquisitions. Corona parent Constellation Brands recently increased its investment in Canopy Growth with a 9.9 percent stake.

The "most important aspect of growth is going to be innovation and R&D," Gorenstein said.

As part of the agreement, Altria will be able to name four directors to Cronos board, including one independent director. These additions will boost the size of Cronos' board to seven from five directors.

Altria also announced plans to discontinue its MarkTen and Green Smoke e-cigarette products and its Verve oral nicotine, citing the financial performance of these products combined with heightened regulatory restrictions for its decision.

Altria said it plans to refocus its resources on more compelling reduced-risk tobacco product opportunities.

In connection with these steps, Altria expects to record a one-time pretax charge of about $200 million in the fourth quarter. Most of the charge will be a noncash asset impairment charge and will be excluded from the company's adjusted earnings.

In midday trading Friday, Cronos shares were up 22 percent on the news, while Altria shares gained 1.1 percent.

—CNBC's Angelica Lavito contributed to this article

WATCH: Six experts on the cannabis craze