After a 150% rise over the past 18 months, Starbucks (Nasdaq: SBUX) has certainly rewarded investors. But does the company have a wide enough moat to keep competitors at bay for the long haul?

The stuff moats are made of
Warren Buffett coined the term "economic moat" to describe the strength of a company's competitive advantages. Many factors confer short-term competitive advantages, but in his excellent The Little Book That Builds Wealth, Morningstar's Pat Dorsey convincingly argues that only four factors create an enduring economic moat. Let's use Dorsey's criteria to see what Apple's moat is made of, and just how sustainable it is.

1. Intellectual property rights
Moat-building intellectual property includes intangible assets like patents, licenses, and brands. Any company can have a brand, but truly moat-widening brands must increase a consumer's willingness to pay for a product.

Moat source: Yes
Starbucks didn't become an $18 billion behemoth because it brews the best-tasting coffee. In fact, some taste tests show that consumers prefer cheaper alternatives from Dunkin Donuts, McDonald's (NYSE: MCD), and even Eight O'Clock Coffee to Starbucks' pricey java. Starbucks excels on selling its customers a premium experience -- a comfortable, relaxing atmosphere and consistent quality -- that its fast-food competitors just can't match. This has helped the company create a global brand worth nearly $8.5 billion, according to brand consultant Millward Brown Optimor.

2. Customer switching costs
Products that are tightly integrated with a customer's business or lifestyle make it difficult for that customer to switch to a competitor's product.

Moat source: No
While consumers may enjoy their Starbucks coffee, there are plenty of cheaper alternatives around every corner -- even in many cupboards, thanks to Green Mountain Coffee Roasters' (Nasdaq: GMCR) popular Keurig system. Starbucks has wisely taken steps to increase its products' stickiness, such as its drink-anywhere Via instant coffee and a revamped customer loyalty program. However, the company is not tightly ingrained enough with its customers' lives to keep them if a double-dip recession rears its ugly head.

3. The network effect
The value of some services increases in direct proportion to the number of people using them. For example, Facebook offers a much richer experience with 500 million users than it did with a handful of undergraduate dorm-mates.

Moat source: No
Additional Starbucks shoppers only make the store more crowded for the other shoppers.

4. Cost advantages
Finally, lower costs can create lasting competitive advantages. The benefits of operational efficiencies and smart processes inevitably erode over time. A truly sustainable cost advantage, like economies of scale or a superior geographic location, simply can't be copied.

Moat Source: Yes
As the 800-pound gorilla in the coffee market, Starbucks enjoys a big edge over its suppliers.

Numbers don't lie
To determine whether a company enjoys a sustainable competitive advantage, examine its return on invested capital (ROIC) over time. Returns consistently exceeding a company's cost of capital suggest that it possesses a nice moat. Here's how Starbucks' ROIC stacks up next to its competitors:

Company

FY2007

FY2008

FY2009

Starbucks

18.2%

11.2%

13.1%

Green Mountain

9.6%

12.6%

10.6%

McDonald's

14.3%

16.3%

17%

Source: Capital IQ, a division of Standard & Poor's. Starbucks' fiscal year ends on the Sunday closest to September 30. Green Mountain's fiscal year ends on the last Saturday in September. McDonald's fiscal year ends December 31.

Survey says: Wide moat!
Any company that can consistently post double-digit ROIC by selling a commodity product is doing something right. Starbucks has a wide moat, based largely on the strength of its brand name.

Ready to buy?
Not so fast, my Foolish friends! Even if you're enamored with Starbucks' strong brand, that doesn't automatically make it a smart buy. While competitive advantage is critical, it's also essential for investors to have a strong understanding of a company's management, finances, and valuation -- and to always buy at a significant margin of safety.

That's the strategy our team at Motley Fool Inside Value employs. You can read all of the team's research reports, and see their best buys for new money now, with a 30-day free trial.