The price of coffee futures has been steadily on the rise over the last few years, but analysts expect the pace of growth to slow over the next two years as the need for restocking is tempered by a surplus in Brazil, one of the biggest growers of coffee in the world. Current prices are around $1.07 per pound, as of October 4, back near early August levels after slipping a little in the last two months. The outlook for year-end is more positive, with analysts forecasting that coffee prices could reach $1.25 per pound by the end of the year, according to Fitch. That means that there are still opportunities for those who want to invest in the companies that produce or market coffee products, but patience and a longer-term horizon are crucial. (See also: Commodities Trading: An Overview.)

What's behind the overall surge in coffee during the last few years? A number of things, actually. Global demand is up considerably, and that is especially the case in the North American markets. Plus, recent weather patterns disrupted the coffee harvest in South America, which is expected to weigh on the Arabica harvest in Brazil, according to some experts. Any disruption tends to ultimately lift prices.

But the outlook for the next few years is mostly muted growth. A recent Reuters poll of 14 traders and analysts showed that the consensus expects global coffee supplies to move to a surplus in 2018 and 2019, with Brazil expected to see a record crop. However, overall prices are still expected to rise a moderate amount by the end of 2018, the analysts said, due to the impact of a variety of countries needing to restock their inventories.

A rise in prices is bad news if you can't function without your morning cup of joe, but it's good news if you're invested in coffee stocks. And if you're not currently in the market but think you might want to jump in, here are three top coffee stocks for you to consider in the last quarter of 2018. Note: All figures were current as of October 4, 2018.

Starbucks Corporation (SBUX)

Starbucks has a presence in 75 countries worldwide and is a global leader in coffee roasting, marketing and retailing. With over 27,000 retail outlets, it's tough to avoid the chain's commanding presence. Starbucks has a market cap of $75.401 billion and raked in annual revenue of $22.38 billion in 2017 with a net income of $2.88 billion. At current share prices of $55.89, the stock is trading at about 17.5 times earnings.

The median 12-month price target of $57.96 implies potential upside of almost 4 percent. Starbucks also paid dividends of $1 in 2017, a jump of nearly 25 percent over 2016's $0.80 per share. The stock is a favorite with major institutional investors including Vanguard, Fidelity and BlackRock. Starbucks stock is currently rated just below Outperform. In August 2018, Starbucks announced a $7.15 billion deal with Nestle for Nestle to market Starbucks products around the world, outside of its cafes; the deal is expected to boost revenue globally. (See also: Rise of Hipster Coffee Shops Won't Hurt Starbucks: Bernstein.)

The J. M. Smucker Company (SJM)

Smucker's might be a name you mostly associate with jellies and jams, but it also owns major coffee brands including Folger’s, Dunkin' Donuts (under a licensing agreement through 2034), Cafe Bustelo, Kava, Medaglia D’Oro and Pilon. With a market cap of $11.566 billion and annual revenue in 2017 of $7.39 billion, Smucker's has a significant presence in the U.S. coffee market. The stock is currently trading at $101.69, down over 18 percent year-to-date; the decline is consistent with the rest of the food sector, which has lagged the broader market. However, forecasts are for improved profitability going forward.

The stock price equates to a P/E ratio of 8.6. In August, Smucker's reported fiscal first-quarter 2019 earnings and revenue that grew from the previous year but nonetheless missed analysts' expectations. The stock is currently trading near its 12-month median price target of $106.93, implying that its upside potential may be limited in the short term. A consensus of analysts rate it a "hold."

Dunkin' Brands Group, Inc. (DNKN)

With over 11,000 restaurants in 36 countries, Dunkin' Donuts is a solid player in the coffee space. The company has a market cap of $5.98 billion and annual revenues of nearly $830 million. The company recently reported second-quarter 2018 earnings and revenue that grew from a year ago and topped a consensus of analysts. The rise in revenue was due mostly to higher royalty payments from system-wide sales growth and a jump in advertising fees. Dunkin' has been competing strongly with rival Starbucks and the stock price has been on the rise in 2018, gaining nearly 11% year-to-date.

At $71.48 per share, the stock trades at more than 17 times earnings. Although Dunkin' licenses its coffee brand to Smucker's, the company sold over 1.7 billion cups of coffee in 2016, or roughly 30 cups every second – a significant revenue driver.

Dunkin' is also a solid dividend stock, paying $1.29 per share in 2017, up 7 percent over the prior year. Dunkin' stock is currently trading at about $71.48, above its 12-month price target of $69.83. A consensus of analysts rate it a "hold." (See also: Starbucks vs. Dunkin' Donuts: Comparing Business Models.)