By Alisha Haridasani

Nestlé's $7.1 billion partnership with Starbucks announced on Monday aims to give the Swiss company an opportunity to regain lost ground in the United States.

Under the deal, the maker of Nespresso and Nescafé will market and distribute Starbucks' packaged products, including branded coffee capsules and tea bags. In return, Starbucks will have access to Nestlé’s vast global network to gain a stronger presence in overseas markets.

In a statement Monday, Nestlé said that its alliance with the Seattle-based coffee brand will serve as “a strong platform for continued growth in North America.”

Nestlé hasn't been able to keep up with shifting consumer demands in the U.S., its biggest market, where coffee-drinkers are looking for freshly brewed products rather than instant coffee, like Nescafé.

It's one reason that Nestlé invested in the high-end coffee brand Blue Bottle last year.

Nestlé's shrinking share of the coffee market is also, in part, driven by competition from JAB. The European holding company has been expanding its coffee portfolio, which now includes Keurig, Peet’s, Stumptown, and Intelligentsia, giving it a foothold in the fresh-brewed and packaged coffee markets.

Shares of both Starbucks and Nestlé rallied on Monday.