Investors are carefully watching the retail sector going into 2023 for signs of a slowing economy and consumer weakness. Still, there are some stocks that are poised to gain even in an uncertain environment, according to Goldman Sachs. Overall, the firm expects real consumer spending to grow by 1.6% in 2023. "While not all retailers face the same compares, we do think compares for the overall industry (unless there is an idiosyncratic reason) are difficult," Kate McShane wrote in a note Monday. "We introduce a framework as a way for picking stocks as we don't believe 'easy compares' will be enough of an investment consideration for those looking to invest in the names." The firm sees a few factors that will lead some companies to succeed in the coming year. These include the ability to gain market share, offset macro pressures, lap competitors, translate cash into shareholder returns and have an attractive valuation. Top pick Goldman's top pick in the space is Bath & Body Works , which it rates a buy, and sees the potential for more than 24% upside. "BBWI stock has started to appreciate more meaningfully since the company reported in late November after an inline sales result but better than expected merchandise margins," wrote McShane. "We continue to recommend BBWI into 2023 given a higher level of newness in stores, increased digital interest and higher sales driven by the company's new loyalty program, and some easing inflationary headwinds on both products costs and transportation." The stock trades at 13.9 times next year's earnings, according to Goldman estimates, which is a premium to where shares have traded but a significant discount to the market and its peers. "Push back for this idea will likely be that the business is highly discretionary and will have a harder time outperforming if FY23 is a year with a tougher macro backdrop as well as the idea that the company is lapping a significant amount of $ growth since 2019 (We estimate BBWI revenue will be up 47.7% in 2022 v. 2019)." Upgrades, downgrades and other recommendations Goldman also reviewed some of its ratings on other retail stocks. It upgraded shares of Best Buy to neutral from sell and raised its price target to $83, implying a 2.5% upside from Friday's close. Though there's still a tough short-term environment, the firm sees the potential for the electronics retailer in the long term to improve margins in the coming years. Best Buy can also continue to gain market share and return cash to shareholders in dividends and buybacks. At the same time, Goldman downgraded shares of Ulta to neutral from buy, citing tougher growth in 2023 after a solid year. The bank also said Ulta's margins skew to the downside and current valuation signals little room to grow. The beauty retailer was an outperformer in the space this year, rising about 14%. Goldman also downgraded to sell shares of Genuine Parts Company and RH, as it sees little to no upside for the stocks in the coming year. It has sell ratings on shares of Bed Bath & Beyond, Big Lots and Williams-Sonoma. On the flip side, it has buy ratings on shares of Walmart, O'Reilly Automotive, BJ's Wholesale Club, Dollar General, Dicks Sporting Goods, Five Below and more. — CNBC's Michael Bloom contributed to this report.