When it comes to building wealth, history has shown that investing in stocks and holding them for long periods of time is best. Add in the tax-advantaged benefits of a traditional or Roth IRA, and there's almost no good reason to not regularly set money aside to invest in superior companies. 

If you're looking for top stocks to buy in your IRA, these three are exactly the kind of great companies that can create wealth: MasterCard Inc. (MA 0.07%)Starbucks Corporation (SBUX 0.93%), and Trex Company Inc. (TREX -1.36%).

Man sitting next to piggy bank, with cash raining down.

Image source: Getty Images.

A commanding market presence

MasterCard, Trex, and Starbucks are very different companies. Yet all three share two important traits that make them ideal long-term investments for a retirement account. 

The first is that they are dominant players in their industries. Starbucks, for instance, has more than 25,000 global locations, making it by far the biggest coffee purveyor on the planet. The company also has a substantial consumer packaged goods business, with products available at tens of thousands of other retail locations and generating almost $2 billion in sales outside of Starbucks stores. 

Presentation slide showing Trex's dominant social media share and brand recognition.

Image source: Trex.

Similarly, Trex is the dominant company in its industry, commanding over 40% of the wood-alternative decking market, with the broadest and most award-winning lineup of products available. Trex has also established itself as the most recognizable brand, with the best consumer awareness, the most searched, most visited website, and most social media interactions of any company in its industry. 

Of the three, MasterCard is the only company that's not the biggest in its industry, and is much smaller than payments processing competitor Visa. Nonetheless, it is the clear No. 2 in the electronic payments business, and is partnered with thousands of banks and tens of thousands of merchants around the world. 

Growth prospects seal the deal

There are plenty of companies with big market share and brand recognition, but those alone don't make a company a definite buy, particularly if the long-term growth potential is weak. Fortunately, all three of these companies are well positioned for big growth going forward. 

For both Starbucks and MasterCard, much of this opportunity is tied to the expansion of the global middle class. In the coming decades, the global middle class will add billions of new members, creating the biggest consumer class in history.

Asian man and woman talking to each other in a supermarket

Asia's consumer class is exploding. Image source: Getty Images.

This expansion is already happening in China and other parts of Asia, where Starbucks is seeing its biggest growth. The opportunity is so significant there that Starbucks' management has already said it expects China to eventually become the company's biggest market. MasterCard, too, has very big potential. As much as electronic payments are commonplace in the developed world, they still make up a small fraction of global transactions. With the advent of mobile computing expected to play an even bigger role in the future, electronic payments are a very serious growth industry. And with its strong, secure network, recognizable brand, and deep relationships with global financial institutions, MasterCard is likely to remain a major part of the electronic payments web. 

And while eventually a more wealthy global population will create opportunity for Trex, its opportunity at this stage is still relatively local and tied to the company's ability to expand the market for wood-alternative decking. It may have over 40% of current market share in its segment, but when it comes to board-feet of total decking sold including wood, Trex only has about 5% of the market. But it has grown its sales faster than total decking revenues for years, and this trend is set to continue, as more homebuyers gravitate toward more environmentally friendly, lower-maintenance products like Trex. 

Think bigger

It's easy to look at Starbucks and MasterCard, already huge companies, and Trex, with its dominant market share, and question just how much room there is to run. But within the context of future opportunity -- billions more potential customers for the former two and a real-wood market that's nearly 20 times bigger for the latter -- these are exactly the kinds of companies that can build real wealth for long-term investors.