Investors were ready to continue their holiday celebrations on Monday, and that showed up in upward movement in major market benchmarks. Indeed, the S&P 500 (^GSPC 0.03%) pushed to new record levels, climbing 51 points to 4,776 as of 12:30 p.m. ET on Wall Street.

Given the strong performance of the tech sector, it would be natural to assume that tech stocks were primarily responsible for the S&P's gains. Certainly, given the large market capitalizations of some of the top players in technology, gains have had an outsized impact. However, largely unnoticed has been the strong performance of energy stocks. Two companies in particular have topped the leaderboard among S&P 500 stocks, and as you'll see below, they're both energy players.

Person working on oil pipeline equipment.

Image source: Getty Images.

Devon leads the way

Shares of Devon Energy (DVN -0.39%) were up another 4% on Monday. The stock remains well off its own all-time highs, but it has been the outright winner among S&P 500 components in 2021, with gains of more than 180% year to date.

It's not a huge surprise to see Devon climbing given the recovery in the oil and natural gas markets. Crude oil prices got crushed in 2020, but they've rebounded sharply in 2021, and that's been a big boon to energy producers across the board. For Devon in particular, higher oil prices have also allowed the company to boost its dividend because the energy producer uses a variable dividend formula to determine how much it returns to shareholders each quarter. In the past year alone, that payout has gone from $0.11 per share in the fourth quarter of 2020 to $0.84 per share in its most recent quarter, for a dividend yield approaching 8%.

Devon has also capitalized on smart plays in the merger and acquisition arena, successfully integrating the business it acquired in its merger with WPX Energy. By boosting its scale and allowing for lower costs, the merger allowed Devon to return even more capital to shareholders through stock buybacks.

Even after an outstanding performance in 2021, Devon could have further to climb. If oil performs well and the business keeps executing strongly, then Devon's 2021 gains could be just the beginning.

Not a sprint but a Marathon

Marathon Oil (MRO -0.72%) is the other big energy contributor to the S&P 500's success. The stock is up 2% today and almost 140% in 2021, just edging out vaccine maker Moderna (MRNA -0.22%) for the No. 2 spot as of this writing.

Marathon has also been a big beneficiary of rising oil prices. With free cash flow growth accelerating, the oil company hopes to use some of its newfound financial resources to pay down debt and reduce its leverage in the future. That in turn could allow for even larger dividends and stock buybacks than what it's currently providing.

Longer term, Marathon's assets give it some flexibility that higher-cost providers don't have, with the ability to generate free cash flow at a $1 billion per-year rate even if crude oil were to fall back toward $50 per barrel. Efforts to cut back on overhead expenses and other non-production costs are also contributing to optimism among shareholders.

Keep an eye on energy

The energy markets have been volatile over the past decade, with violent swings from boom to bust and back again. In a market dominated by tech names, though, there are opportunities for energy investors to capture some opportunities that many are letting go by unnoticed.