The retail sector got a win Friday when Goldman Sachs upgraded Wal-Mart Stores Inc. (WMT) to buy and added it to its conviction list. The Arkansas-based retail giant is one of many faced with the daunting task of fending of e-commerce giant Inc. (AMZN), a task Goldman Sachs believes Wal-Mart can handle. "We believe that the company is as well positioned as any mass market retailer – in an admittedly imperfect world for mass market retailers – to cope with increasing demands on e-commerce and technology spend, weather AMZN’s growth and its increased focus on consumables, and maintain its franchise," Goldman Sachs said in a note Friday.

"We see merits in WMT’s front-loaded investment, scale, capacity for additional investment, small-market focus, and current impressive inventory discipline."

Wal-Mart share holders lost as much as 8.8 percent in the aftermath of Amazon's June 13 acquisition of Whole Foods as investors braced for increased competition from an established brand with established supply chains. Despite this, Goldman Sachs believes Wal-Mart can survive the onslaught of Amazon, raising its 12-month target to $84, which represents a 12 percent gain from Thursday's closing price.

The U.S, investment bank noted ten drivers behind its buy call: 1) scale to undertake investment in the tech and e-commerce space – Wal-Mart has $6.9 billion in cash and ST investments, according to FactSet data; 2) small market focus, which Goldman Sachs believes poses less risk to grocery competition; and 3) and the bottom of food inflation. (See also: Wal-Mart, Costco Will Outperform in Face of Amazon)

Source: Goldman Sachs

Despite the obvious threat from Amazon, Goldman Sachs see price competition the major threat for its call. "The hard discounters present a different challenge, as they price sharply and threaten to eat into fill-in trips. That said, WMT has cut pricing in many markets in anticipation," Goldman Sachs said. (See also: Wal-Mart Orders Tech Partners to Get Off Amazon Cloud)

Shares in Wal-Mart rose by as much as 1.6 percent Friday, reaching a high of $76.40. Despite falling 2.6 percent Monday, they are set to finish the week higher.

Want to learn how to invest?

Get a free 10 week email series that will teach you how to start investing.

Delivered twice a week, straight to your inbox.