Warren Buffett's Berkshire Hathaway (BRK.A 0.36%) (BRK.B 0.21%) has gotten a lot of attention as of late, and for good reason. Despite Buffett's long-term outperformance, Berkshire Hathaway had been underperforming the S&P 500 and the Nasdaq Composite in recent years due to Berkshire's lack of technology stocks that have been responsible for the bulk of the market's gains.

But so far in 2022, Berkshire Hathaway stock is up 16%, while the S&P 500 is down for the year -- largely thanks to the recent success of value stocks relative to growth stocks. What's more, Berkshire Hathaway stock hit a new all-time high on Monday.

Short-term results aside, here are three Warren Buffett lessons that have proved invaluable over time and ring especially true today.

Berkshire Hathaway CEO Warren Buffett.

Image source: Getty Images.

1. Don't follow the crowd

If there's one thing we've learned over the last two years, it's that following the crowd is a fantastic way to lose money.

After the COVID-19-induced stock market sell-off of spring 2020, meme stocks, unprofitable growth stocks, and pandemic-related stocks took center stage. Companies like Zoom Video Communications and Peloton Interactive produced monster gains, while the energy sector, financials, and real estate stocks got crushed. In 2021, the exact opposite was true, as many of these pandemic winners lost money while the energy sector was the best-performing sector in all of the S&P 500.

Fast-forward to 2022, and several top large-cap growth stocks have seen major drawdowns while value stocks and stable dividend payers have been the real winners. The lesson here is that jumping in and out of what is working or not working in a given time period is a bad idea. For years, Warren Buffett and his team were scrutinized for keeping a large cash position and not buying more stocks. But in the end, Buffett's patience paid off, as Berkshire has had plenty of dry powder to pounce on opportunities, as evidenced by its recent acquisition of Alleghany.

2. Invest in what you know

Buffett is a proponent of investing in what you know so that you have an advantage in the stock market. It's a simple enough task, but it's actually pretty hard to execute in practice.

Times change, and the economy is becoming more digitalized than ever before. Investors who may not understand technology-focused companies could follow Buffett's footsteps and basically ignore the sector or invest in a relatively easy-to-understand business like Apple.

However, another option is to learn about a business and listen to the quarterly earnings calls. It requires more work but will also give you the tools you need to hold a company through tough times and let the investment thesis play out. And if the investment thesis begins to change or the company loses its edge over the competition, you'll be better positioned to exit the position and avoid a falling knife.

3. Greed and fear

Typing it all together is Buffett's famous quote to "be fearful when others are greedy, and greedy when others are fearful." The advice applies perfectly to buying the dip in the U.S.-China trade war-induced sell-off at the end of 2018, the 2020 sell-off, and probably will apply well to the current sell-off we are in now. However, the advice to be fearful when others are greedy is also worth discussing.

Many growth companies saw their valuations pole-vault to astronomical levels that weren't based on fundamentals or even the most optimistic forecasts. When that happens, Buffett's advice is to be fearful, as it could be a sign of an unhealthy stock market.

Buffett has been a big believer in finding value where others aren't looking. In many ways, the oil and gas industry was chock-full of high-yield dividend stocks and value stocks that investors were ignoring in favor of renewable energy and flashier names. Carbon neutrality is the future. But the world still runs on fossil fuels. Buffett's ability to take criticism and invest in "ugly" stocks allowed him to make brilliant buys, such as the acquisition of some of Dominion Energy's energy infrastructure assets in July 2020, the gradual accumulation of Chevron stock, and other investments made through Berkshire Hathaway Energy, the conglomerate's energy arm.

Keep your cool when times are tough

When your screen is painted red and stocks keep falling with no end in sight, it's easy to panic and make a decision you might later regret. By relying on timeless investing lessons, investors have a few tools they can pull out when times are tough. Instead of downplaying the emotional side of investing, it's often better to accept the associated emotions and just try and make the best decision you can with what you know.

One of the most comforting facts to fall back on is the long-term performance of the U.S. stock market. That track record teaches us that every sell-off proved to be a great long-term buying opportunity.