Stock investors have gotten a harsh reminder in 2022 of what a typical bear market looks like. Major stock indexes have fallen sharply and stayed at depressed levels throughout the year. Heading into the last week of 2022, the S&P 500 (^GSPC -0.74%) is down 19% since the end of 2021. Many of the roughly 500 stocks that make up the index have seen losses that were far worse.

However, there are some stocks that have found ways to post gains in 2022, even in the midst of a bear market. In fact, two S&P 500 stocks are on track to double from their end-of-2021 levels if they can hold onto their gains in the final week of the year. Read on to learn how Occidental Petroleum (OXY -1.12%) and Constellation Energy (CEG 0.48%) put themselves in position to be the best performers in the S&P 500 this year.

An oil stock with the Warren Buffett seal of approval

Occidental Petroleum has been the best performer in the S&P 500 in 2022, with gains of more than 120%. The integrated oil and natural gas company has benefited from strong energy prices along with many of its peers, but Occidental has also gotten a big vote of confidence from one of the most successful long-term investors ever: Warren Buffett.

Buffett's Berkshire Hathaway has invested an estimated $9 billion in Occidental stock so far this year, adding to an investment the insurance giant made before the pandemic in 2019. The Oracle of Omaha's initial holdings came from helping to finance Occidental's massive acquisition of Anadarko Petroleum, which gave Berkshire income-producing preferred stock and warrants to buy common shares.

Occidental stock has seen bigger gains than other major oil companies for several reasons. Although it's an integrated energy company, the largest part of its business comes from exploration and production activity, which gets the most direct benefit when energy prices move higher. In addition, because of the substantial leverage that Occidental took on in buying Anadarko with debt financing, shareholders have seen a greater per-share profit bump from the favorable industry environment than those in a less leveraged company would.

Everything about Occidental's future success depends on whether oil prices stay at elevated levels or reverse course in 2023 and beyond. Yet even with investors expecting a 25% pullback in earnings next year, the stock still trades at a forward multiple below 9 -- making Occidental the sort of value Buffett can appreciate.

A forward-looking utility giant

Meanwhile, Constellation Energy lagged just behind Occidental Petroleum's performance with a gain of about 110% in 2022. Indeed, the gains don't even cover the whole year, because Constellation got spun out from former parent Exelon in mid-January.

Utility companies in general have seen mixed performance in 2022. Investors have liked the stability that typical utilities offer, but the rise in interest rates has made their dividends somewhat less attractive in comparison to fixed-income securities.

Yet Constellation stands out from most utilities in that it has fully embraced a future in which fossil fuels no longer play a role in energy production. Constellation has an extensive portfolio of nuclear power generating facilities, and it also has become a leader in renewable energy. You'll find utility-scale solar projects, wind power facilities, and hydroelectric power plants among Constellation's growing collection of renewable generation assets.

Investors have high hopes that Constellation will see even bigger earnings in 2023. If things turn out that way, the stock could keep seeing gains in the year to come.

Two angles on the future of energy

It's interesting that a carbon-intensive business like Occidental and a renewable giant like Constellation were both winners in 2022. Yet it just goes to show that even in a bear market, you can find successful investments. Here's wishing you and yours the best New Year's greetings and a more prosperous 2023!