If you want your investment portfolio to outperform the way Warren Buffett's has, it's important to hold stocks for long periods the way he does. When asked what an ideal holding period is for the stocks he adds to Berkshire Hathaway's (BRK.A -0.76%) (BRK.B -0.69%) equity portfolio, the Oracle of Omaha confidently says "forever" to anyone who will listen.

No matter how long you hold a stock, the price you pay factors into the strength of your return. If you want to invest like Buffett, buying stocks at opportune times is an important part of the strategy.

Smart investor evaluating stock charts.

Image source: Getty Images.

Now could be a great time to scoop up a pair of Buffett stocks. At recent prices, $24.6 billion of Berkshire's equity portfolio is invested in two companies that Wall Street has an eye on. Recently updated price targets from a couple of analysts at Citi suggest these stocks can climb 37% and 14% over the next 12 months.

1. Amazon

Buffett trimmed Berkshire's Amazon (AMZN 3.43%) stake by about half a million shares in the third quarter and retained an even 10 million. Ronald Josey, a sell-side analyst at Citi, probably thinks Buffett should have held on to the entire position.

Amazon shares are up about 83% this year, but Josey thinks the rally could run higher still. He recently raised his price target on Amazon to $210, implying a 37% gain over the next 12 months.

Josey is encouraged by Amazon's dominant position in America's e-commerce industry. Its third-party retailers are locked into their relationship with Amazon, as evidenced by soaring ad sales. In addition to its standard take rate, Amazon was able to squeeze an extra $12.1 billion worth of ad payments from third-party merchants in the third quarter. That was 26% more than the previous year period, and this isn't the company's only big growth driver right now.

Amazon Web Services (AWS) is America's largest provider of cloud services, and growth has been resilient this year despite a challenging macroeconomic environment. Third-quarter AWS revenue rose 12% year over year to $23 billion, and this segment has lots of room to run. The global market for cloud services reached $484 billion in 2022, and it's expected to climb by 14.1% annually through 2030.

2. Coca-Cola

It didn't start this way, but at more than $23 billion, Coca-Cola (KO) is Berkshire Hathaway's fourth-largest equity holding right now. Coca-Cola shares have declined about 8% in 2023, but Citi analyst Filippo Falorni expects a rebound in 2024. He recently raised his price target on the stock to $67 per share, which implies a 14% gain over the next 12 months.

Steadily increasing dividend payments are the main attraction for this stock. In February, Coca-Cola raised its payout for the 61st year in a row.

With exactly 400 million shares in its portfolio, Berkshire is in line to receive more than $736 million in dividends from Coca-Cola in 2024, assuming it maintains its long-running streak.

Fear that increasingly popular weight management drugs such as Mounjaro could hammer sales of sugary sodas has Coca-Cola's stock price under pressure. The fear seems overblown. North American case volume didn't rise in the third quarter, but it didn't fall either.

Time to buy?

Amazon offers a chance for big gains on the back of some exceptional businesses. Amazon Web Services is the world's largest provider of cloud services, and its e-commerce operation has logistical capabilities that its competitors can only dream of.

While Amazon has plenty of avenues for growth, there's a lot of success already baked into its stock price. It's been trading at a nosebleed-inducing multiple of 94 times trailing free cash flow. If earnings don't rise sharply over the next few years, the stock could tank. If you don't have a high tolerance for risk, it's probably best to watch from a safe distance.

With some of the most recognized brands on the planet, Coca-Cola has all kinds of pricing power that allows it to overcome a long-running trend toward lower consumption of sugary sodas. If we ignore the negative effects of a stronger dollar, third-quarter revenue rose 11% year over year.

At recent prices, Coca-Cola shares offer a 3.1% yield and most likely a lot more by the time you're ready to retire. For most investors, adding some shares to a diversified portfolio in 2024 and holding them for the long run isn't a bad idea.