The energy sector is far from a shining star in this stock market, but all hope isn't lost, analyst Dave Rosenberg of Gluskin Sheff says. In fact, he argues in a new research note that energy companies' stocks are priced as if oil was trading for $10 less per barrel than it really is.

"One sector we continue to remain bullish on is the energy sector, although sometimes it feels like our enthusiasm is to no avail," Rosenberg wrote in a note released Thursday.

It's true that the S&P 500's energy sector is down 8% so far this year even as the overall index rose some 1.5%. And in the past 12 months, energy stocks fell 5.6% while the S&P 500 as a whole rallied 14.8%. In fact, Rosenberg noted in his analysis that since oil prices peaked in mid-2014, the S&P 500's energy components have lost 32.6% vs. a 37.5% gain for the overall S&P 500. That's "a whopping 70.1% underperformance," the analyst said.

Still, Rosenberg added that a divergence of opinion about the energy industry has bubbled up following a global supply glut that took hold from 2013 to 2015. "The bulls will point to the OPEC and Russian supply-cut response that helped bring balance between supply and demand, in addition to an increase in organic demand from an improving global economy," he wrote. "The bears will point to the U.S. shale industry with its record production and nimble cost structure that allows for a rapid response to price changes."

But ultimately, the analyst believes that the bulls will win. Rosenberg wrote that although OPEC and Russia will eventually wind down production cuts as the market returns to balance in 2018 and 2019, the expanding U.S. shale industry won't be able to keep growing at its current rapid pace forever.

He added that investor focus "has shifted from an emphasis on capex and growth spending to capital discipline and distribution to shareholders." That's important, because industry executives have blamed a dramatic energy oversupply that the market faced in recent years on companies expanding production to mollify investors who emphasized growth.

"There is no reason to expect management to ignore investors this time around with the emphasis placed on the bottom line instead," Rosenberg wrote. "Some producers have already begun to reflect this in their proxies."

"The final cherry on top may be the return of the futures market to backwardation -- meaning the spot price of oil is higher than the price in the future," Rosenberg added. He said that's taking place in both Brent and WTI crude, signaling a market that faces tighter supplies.

"As long as this structure remains, there will be an incentive for global stockpiles to continue to decline -- mitigating the chance of a repeat of what happened in 2014," he wrote.

Still, Rosenberg said many oil companies' stocks are priced as if crude sold for far less than it actually does. But he believes it makes little sense for oil-stock multiples to continue to contract even as some companies have seen their largest energy drawdowns in 10 years.

Besides, the analyst expects energy earnings to grow 74% in 2018, followed by another 11% in 2019. "Sure, the comparables may be coming off a low base, but where else can you get those kind of growth numbers for a 19x forward P/E ratio?" he asked. Rosenberg noted that the tech sector trades at a similar 18.5x forward P/E even though experts only expect that space to grow earnings 11% in 2018 and 2019.

"The fundamentals surrounding the price of oil itself appear fine, the profitability of energy producers are fine, management focus is increasingly shifting to capital discipline and return of capital to shareholders and valuations are cheap," Rosenberg said. "So again, someone please tell us why these stocks are showing no response?"

Jim Cramer's charitable portfolio currently owns four energy stocks: Apache Corp. (APA - Get Report) , Cimarex Energy Co. (XEC - Get Report)  , Magellan Midstream Partners LP (MMP - Get Report) and Schlumberger Ltd. (SLB - Get Report) . You can find out why and check out his entire portfolio by joining Jim's Action Alerts Plus club for investors.