Stock markets have taken investors on a roller-coaster ride lately, with a relentless oscillation between up days and down days. On Friday, bullish investors got the better of things, sending the Dow Jones Industrial Average (^DJI -0.98%) and S&P 500 (^GSPC -0.46%) up by more than 0.5%. The Nasdaq Composite's (^IXIC -0.64%) gain was more modest, extending the narrative that has played out through just about all of 2022.

Index

Daily Percentage Change

Daily Point Change

Dow

0.53%

176

S&P 500

0.59%

22

Nasdaq

0.21%

22

Data source: Yahoo! Finance.

Even as some technology stocks continued to struggle on Friday, the market's best-performing sector of 2022 once again reasserted its dominion over Wall Street. Energy stocks moved sharply higher, and many believe that even though they produced huge gains this year, the biggest companies in oil and natural gas could once again have a positive impact on the stock market come 2023.

How energy stocks fared Friday

Many stocks in the energy sector saw solid gains on Friday. Among the biggest names, Dow component Chevron (CVX 1.04%) rose by 3%, while fellow oil giant ExxonMobil closed the session 2.6% higher.

Some smaller companies saw even bigger gains. Exploration and production company ConocoPhillips finished the day more than 4% higher, while APA was up nearly 6%, and Chord Energy managed a 5% gain.

Oilfield services specialists also enjoyed gains. SLB and Baker Hughes each picked up about 3% on the day, while Halliburton was up by 4%.

Even refining companies joined in on the positive mood. Valero Energy finished the trading day 4% higher, while Marathon Petroleum posted a 3.1% gain, and Phillips 66 was up 3.4%.

Rising energy prices are helping stocks

The rises in energy stocks were driven largely by increases in the prices of energy commodities. West Texas Intermediate crude oil finished higher by nearly $2 per barrel, approaching the $80 mark. Brent crude was up more than $2.50 per barrel, moving above $84.

Refined products saw even larger gains on a percentage basis. Gasoline futures were up by more than $0.12 per gallon to $2.38, while heating oil also rose $0.12 per gallon to $3.21. Natural gas prices climbed $0.09 to close the day back above $5.

What's coming in 2023?

Long-term investors need to remember, though, that many of the factors that move energy stocks from day to day are fleeting by nature. For instance, many energy market participants said that worries about the impact of the massive winter storm hitting much of the U.S. this week are affecting prices, with particular concern that the cold and snowy weather will force production and refining activity to a temporary halt. That won't necessarily have any lasting impact on long-term supply and demand, but it could produce significant volatility in energy markets over a period of days or weeks.

There are, though, some things that could happen in 2023 that would potentially send energy prices higher. China's economy has been sluggish in part because of its pandemic restrictions, but as its relaxation of its zero-COVID policies moves forward, its energy demand could dramatically increase. Moreover, if the war in Ukraine continues, we could see production cuts from Russia -- a major energy commodity exporter -- as price caps imposed on Russian crude have already led the Kremlin to announce it was cutting volumes.

At the same time, though, some other events could weigh on the energy sector. A recession in the U.S. and other major world economies could reduce global industrial activity, diminishing energy demand. Moreover, if the war between Russia and Ukraine were to end, that could lead to the removal or reduction of sanctions, which in turn could lead to greater supplies of oil and natural gas hitting the market.

What investors shouldn't count on, though, is energy stocks repeating in 2023 the 62% rise they have delivered so far in 2022. Even under positive scenarios, more modest gains are much more likely -- and it'll be interesting to see how it all plays out in the year to come.