Finding the right stocks for your portfolio doesn't have to be difficult. Great businesses are built to withstand the test of time even as stock prices shift.

Quality companies continue to widen their moats even in rocky periods, and share prices will eventually follow. As the market has had a solid first several months of 2024, if you're looking for top stocks to buy and hold for the long haul, you don't have to search far.

Here are two rock-solid buys to add to your basket right now.

1. Amazon

Amazon (AMZN 0.08%) isn't a new name to investors. This diversified tech giant continues to prove that its businesses can withstand the shifting tide of the markets in which it operates and generate substantial profits in the process.

Amazon's strides in the world of generative artificial intelligence (AI) are driving its mainstay cloud-computing business forward, the segment that accounts for most of the company's operating income. Meanwhile, its flagship e-commerce business continues to account for most of its overall net sales. The company is also witnessing notable growth in other areas, including its advertising business.

In the first quarter of 2024, Amazon's net sales rose 13% year over year to $143 billion. Sales from its cloud-computing segment rose 17% from the year-ago period to $25 billion. Online-store sales totaled approximately $55 billion, while sales from third-party seller services came to around $35 billion, up 7% and 16%, respectively, from one year ago. The advertising segment raked in $12 billion in net sales, a whopping 24% increase from one year ago.

Amazon's operating income totaled $15 billion, up approximately 219% from one year ago. Of that total, AWS segment-operating income accounted for $9.4 billion, or more than half of overall-operating income. Amazon's net income more than tripled from one year ago, reaching $10.4 billion in Q1 2024.

The company's generative AI platform Amazon Bedrock is being used across countless use cases from clients in very regulated industries like banking and insurance to healthcare companies. As one example, management said in the company's Q1 earnings report that the Dana-Farber Cancer Institute built a new research tool using Bedrock that helps medical providers interpret lab results to reach diagnoses, evaluate treatment regimens, and determine forms of care.

Meanwhile, Volkswagen Group's Audi used other AI tools like its cloud-based machine learning platform Amazon Sagemaker and its OpenSearch Service to make a generative AI chatbot that streamlines both enterprise and internal operations.

The sky appears to be the limit for Amazon and its long-term growth runway. This is a buying proposition that investors might be hard-pressed to overlook.

2. Pinterest

Pinterest (PINS -0.71%) has had its fair share of ups and downs following its peak of growth during the pandemic. Even as the company is dealing with a still-challenging ad-spending environment, its financials are improving consistently with each passing quarter.

Its focus on operational efficiency and improving its advertiser experience with an increasing array of ad formats is paying off. In Q1 2024, Pinterest hit a huge milestone for its business. It now has roughly 518 million active users on its platform every single month. That figure was up 12% from one year ago, but approximately 78% from the same quarter in 2019.

On the financial front, the company brought in revenue of $740 million in Q1 2024. That was a very healthy 23% bump from one year ago. Pinterest reported a net loss of about $25 million according to generally accepted accounting principles (GAAP), but that was a notable 88% improvement from its net loss one year ago.

Pinterest generated adjusted earnings of $113 million, an increase of 319% from the same quarter last year. Global average revenue per Pinterest user totaled $1.46 in Q1 2024, up 10% from one year ago. This is also a business that is bringing in considerable cash flow, with operating cash flow jumping 94% year over year to $356 million in Q1.

Pinterest makes money from running ads for businesses of all sizes, and management has stated that its goal is to make every "pin" shoppable eventually. The company has made a stream of updates to its ad offerings in recent years and just launched shoppable video pins this past quarter.

This means that a user could search for a topic of interest, find a video ad that aligns with that topic, and click the video to view a deck of pins that match the items in that video. Then, they can click any one of those pins to be taken directly to a product or service to purchase.

There's so much room left for Pinterest to grow as ad spending recovers. Given the unique advertising format of its platform, investors might want to consider even a modest position in this stock in the near future.