As Berkshire Hathaway CEO Warren Buffett has famously said, it often pays to be greedy when others are fearful and fearful when others are greedy -- and there's certainly no shortage of fear shaping today's stock market backdrop. Macroeconomic conditions have generally led to brutal trading for tech stocks this year, and the growth-heavy Nasdaq Composite index is currently down 28% across 2022's trading.

Economic uncertainty suggests that the market could continue to be turbulent in the near term, but investors also have opportunities to buy shares in category-leading companies at prices that set the stage for attractive long-term returns. Read on to see why taking a buy-and-hold approach to these two stocks held in the Berkshire Hathaway portfolio would be a smart move. 

Warren Buffett.

Image source: The Motley Fool.

1. Amazon

Amazon (AMZN -1.65%) stock has gotten crunched this year due to macroeconomic challenges, headwinds for its e-commerce segment, and signs that growth for its Amazon Web Services (AWS) cloud infrastructure business is slowing. The tech giant's share price has fallen 45% year to date, and it's off roughly 51% from the peak it hit in 2021.

Facing inflationary pressures including rising fuel and labor costs, Amazon's profitability has slumped. Big e-commerce investments in response to surging, pandemic-driven demand that has since moderated haven't helped things either. To put the impact of these dynamics in perspective, the company's free cash flow for the trailing-12-month period at the end of the third quarter swung to an outflow of $19.7 billion -- down from an inflow of $2.6 billion at the end of the prior-year period.

When it comes to Amazon's recent earnings reports, you don't have to look hard to find underwhelming comparisons for what was previously a high-growth business. On the other hand, it would be a mistake to focus on soft performance in the near term over the company's strong positioning for the long term and attractive valuation.

AMZN PS Ratio Chart

AMZN PS Ratio data by YCharts

Valued at roughly 1.9 times last year's sales and 1.8 times this year's expected revenue, Amazon is trading near decade-long lows on a price-to-sales basis. While the company's revenue growth has slowed, the business's ability to generate profits has improved dramatically. Much of that is down to the evolution of AWS, and the tech giant's category-leading cloud services business continues to look well positioned for profitable growth despite macroeconomic conditions leading to slower rates of revenue expansion in the near term. 

Amazon is a fantastic company that's built to weather challenges, and this year's sell-offs have created a worthwhile buying opportunity for investors. 

2. Taiwan Semiconductor Manufacturing

Berkshire Hathaway's most recent 13F filing revealed that the investment conglomerate initiated a position in Taiwan Semiconductor Manufacturing Company (TSM -3.05%). TSMC is the world's leading manufacturer of semiconductors, and the chips it fabricates are at the heart of everything from consumer-electronics hardware to data centers and automobiles. Put simply, it's one of the most important companies in the world. 

While there are plenty of companies out there that design chips, few have the ability to actually fabricate their designs. Even companies with significant fabrication capabilities including Intel and Samsung turn to TSMC for some of their fabrication needs. No other company has the scale, infrastructure, and technology advantages needed to rival TSMC in the fabrication space. But the semiconductor-fab leader hasn't been immune to this year's tech valuation pullback. 

In addition to rising interest rates and other macroeconomic pressures depressing valuations for growth stocks, TSMC's share price has fallen due to concerns that China could move to exert greater influence over Taiwan. The recent investment from Buffett and Berkshire seems to suggest that the Oracle of Omaha and his analysts believe these risk factors are overblown -- and that the chipmaker's valuation has been pushed down to attractive levels. 

TSMC's stock price has slipped roughly 33% year to date, and it trades down 43% from the high that it reached at the beginning of this year.

TSM PE Ratio (Forward) Chart

TSM PE Ratio (Forward) data by YCharts

While the chip industry has historically been somewhat cyclical, the stock looks attractively valued trading at about 12.5 times this year's expected earnings. The chip giant also pays a dividend, with its current payout sitting at around 2.3% based on today's stock prices. 

With demand catalysts stemming from technology trends including artificial intelligence, cloud computing, machine vision for automotive applications, and the Internet of Things, the semiconductor industry still has a very robust growth outlook -- and TSMC will play a huge role in pushing the tech space and overall global economy forward.