A flash-in-the-pan stock rally can come from anywhere. But virtually all long-term wealth creation stems from durable competitive advantages.

And you can sniff out those competitive advantages using Porter's Five Forces.

For example, you might know that Chinese search engine Baidu (Nasdaq: BIDU) is expected to deliver +40% compounded annual earnings growth (CAGR) during the next five years. But so do about 10 million other people that are watching the stock. That optimism is already priced into the shares.

That doesn't necessarily mean Baidu's meteoric ascent is over, but any future gains are hardly a slam dunk.

The real winners spotted the company's potential back in 2006. They understood what surging Internet traffic, skyrocketing paid search revenues and a highly scaleable business model could do long before it actually played out. Then they held on tight as the shares went from $50 to $450.

Companies like Baidu have something that their rivals just can't emulate -- and that's why they've been so successful.

Successful companies are able to build economic moats that help them defend their territory from marauding competitors. The wider the moat, the longer a company can hold rivals at bay and continue generating outsized returns for shareholders. Warren Buffett won't even sniff at a company without a moat to protect its returns on capital.

If the crash of 2008 taught us anything, it's that the numbers on a firm's balance sheet and income statement can change with the financial weather. So I prefer to spend less time monitoring sales and profits and more time evaluating the underlying factors that influence them.

If for no other reason, they can give you a critical 'heads-up' that changes (either positive or negative) are right around the corner.

One of the most basic rules of stock analysis is that you should avoid comparing the profit margins of companies in different sectors. After all, a grocer that pockets 5% of every dollar in sales might be best-in-class, while a biotech firm with margins of 25% could be the group's laggard.

Most experts will tell you that it's best to compare grocers to grocers and biotechs to biotechs. While that may be true, they're missing the bigger picture. Instead, ask yourself this: Why can some industries maintain profit margins that are so much higher than others?

The answer lies in the 'Five Forces' diagram below, which was developed by Harvard Business Professor Michael Porter.

PortersFiveForcesExhibit(3)

Let's briefly examine each of these forces:

Competitive Rivalry: This refers to the intensity of the competition within the industry itself. Concentrated industries with only a handful of players tend to be less competitive and more profitable than fragmented industries (like fast-food) where hundreds of players try to undercut each other.

Barriers to Entry: Success always invites competition. But some industries have high barriers to entry that shut out would-be competitors. Barriers can be anything from government regulation to capital requirements. Any potential business owner can start an online retail business, but it would be much more difficult for a potential business owner to buy a fleet of cruise liners.

Threat of Substitutes: Products or services that are easily replaceable can't command top dollar -- customers will simply switch to option 'B'. Therefore, look for industries producing goods or services with no close substitutes. Computer makers, for example, can't get too far without semiconductors.

Bargaining Power of Suppliers: The first three factors were horizontal, but the last two are vertical. If you are making bicycles, and there's only one tire supplier in your area, then you have no choice but to buy from them. They hold all the cards. But if there are a half dozen tire makers, you can negotiate a better deal -- particularly if you're the biggest purchaser on the block.

Bargaining Power of Customers: In a monopoly, there are many buyers, but just one dominant seller. The flip-side is a 'monopsony,' where there are many sellers, but just one buyer (like specialized defense equipment sold to the government). In this case, it's the buyer that calls all the shots.

We've barely scratched the surface here -- but you get the idea: a company's profitability and stock price are both governed by the competitive framework of its industry. All of Porter's Five Forces interact to determine whether a specific industry is highly attractive to investors, or screams, 'stay away!'

We see these five forces at work all the time. Sometimes suppliers must cave to the demands of a powerful buyer like Wal-Mart. Other times it's the buyers that must yield to the demands of the seller -- like when BHP Billiton dictates iron-ore prices to steelmakers.

There is a symbiosis to any business relationship. The buyer needs the seller's wares, and the seller needs the buyer's money. But, the balance of power always favors one party over the other. If you can determine who has the upper-hand in these relationships, you'll be a step ahead of the crowd.