One of the best things about participating in the stock market is that even relatively small investments can make a big impact on your retirement portfolio over long time frames. Those compounding gains will often be amplified by dividend payments, too, which an investor can choose to have automatically reinvested each quarter.

But which stocks fit in that rare category of promising both income and capital appreciation for years or decades?

It's impossible to know for sure, of course. But investors can maximize their odds by focusing on proven winners with dominant market-share positions and stellar balance sheets. Let's take a look at two great examples. Read on for some good reasons to put $5,000 to work owning shares of Coca-Cola (KO) and Microsoft (MSFT 1.82%).

Make it a large soda

It's not an exaggeration to say that Coca-Cola has one of the most dominant market share positions on the stock market. With its dozens of beverage brands, it accounts for over 3% of all drinks (that's 2.2 billion) consumed around the world each day. It's no wonder that the company has been making money for more than a century.

Coke isn't a boring investment, either. Organic sales rose 11% in the most recent quarter, thanks to solid demand for core franchises like Coke Zero. Operating profit margin rose to a market-leading 32% of sales, too, reflecting its incredible efficiency and a tilt toward non-traditional drinks, like bottled waters and energy drinks.

This investment is likely to pay increasing dividends for the foreseeable future, too. Coke generated $4 billion of free cash flow in the first half of 2023, after all. Success here allowed management to allocate nearly $8 billion to dividends in 2022, and Coke has raised that payout in each of the last 60 years.

The stock is attractively priced right now. It declined in 2023 despite those excellent sales and earnings trends.

Diversify your tech investments

By contrast, Microsoft isn't being sold at a discount today. But investors get an impressive array of assets by owning this tech stock. One of the biggest is Microsoft's exposure to a wide range of growth niches. Whether it's cloud services, cybersecurity, artificial intelligence (AI), video games, or consumer tech, you'll likely benefit from the industry's expansion as a shareholder.

The company also is swimming in cash. It generated $24 billion of operating profit this past quarter, up 21% year over year. Microsoft had $34 billion of cash on the books as of late June and generated $88 billion over the previous six months.

That huge cash pile allows management to invest aggressively in growth initiatives while still delivering lots of cash directly to shareholders. Microsoft spent $6 billion repurchasing its stock last quarter and allocated a further $5 billion toward dividend payments.

Sure, that dividend yield of 0.8% is tiny, compared to Coke's 3%. But patient investors can wait while Microsoft prioritizes growth investments for now, with bigger dividend income likely in years to come.

As mentioned earlier, the stock doesn't seem especially cheap, valued at 33x earnings. But having a time frame that's measured in decades allows an investor to be less concerned with modest valuation shifts. Whether you buy the stock at a price-to-earnings ratio of 30 or 35, you're likely to be happy to have placed a few Microsoft shares in your retirement portfolio.