Walmart's underperformance this year makes the stock relatively cheap and creates an attractive buying opportunity for investors, Wells Fargo said. Analysts led by Edward Kelly upgraded the retailer's stock to overweight from equal weight. The firm raised its 12-month price target to $165, 15.5% higher than Wednesday's closing price of $142.84. "WMT stock has underperformed many peers since COVID began given that it has not benefited nearly as much from the pandemic," Kelly said in a note Thursday. "[W]e see a potential inflection in this lagging name." Shares of Walmart are down 0.9% in 2021, falling behind competitors like Target , Kroger , Dollar General and Home Depot , which are all up double digits. The broad S & P 500 is also 17% higher in 2021. "WMT was not a COVID winner. It lost share in consumables to local grocers as consumers prioritized convenience, quality, and selection over value. WMT's reduced hours also did not help," Kelly said. However, as consumers return to pre-pandemic behaviors and life normalizes, Wells Fargo believes Walmart will take back market share. In fact, the retailer already began to see some share shift in the first quarter of 2021. While expiring pandemic-related stimulus and rising prices create a headwind for Walmart, the firm said child-tax payments and recent wage hikes should help lower-income customers. "The cross currents in consumer are growing, but we remain supportive of exposure to the lower end," Kelly said. Plus, Walmart is well-positioned to combat inflationary pressures due to its scale and price leadership, Wells Fargo noted. The company also proactively raised wages in 2021. Walmart's initiatives like Walmart+, digital ads, clinics and fintech provide further "underappreciated" opportunities for the company to add value, according to Wells Fargo. —CNBC's Michael Bloom contributed reporting.