The best performing retail stock this year is no surprise: Amazon is up 54% so far in 2018.
But you may be surprised to learn that Macy's, often considered a casualty of Amazon, is the second best retailer.
Shares in the department store are up more than 50%, which makes it the 10th best performer in the S&P 500 this year.
A number of factors have driven Macy's (M) performance.
For one, the retailer recognized that had to be a bigger player in digital as more people shop on their phones, tablets and computers.
CEO Jeff Gennette -- who took over for longtime Macy's CEO Terry Lundgren in March 2017 -- boosted Macy's e-commerce and mobile efforts. Digital sales have been growing at a double-digit clip for the past few quarters as a result.
The company also continues to invest heavily in its Bluemercury chain of specialty beauty stores and its discount outlet, Macy's Backstage.
Another reason for the Macy's turnaround: The company has started to close underperforming stores and has sold off some of its real estate holdings. That helped cut costs and boost profits.
Its unclear if that will that be a long-term strategy for fending off Amazon (AMZN) and other retailers like Walmart (WMT) and Target (TGT). But analysts like its chances.
Moody's put out a report this week about department stores and specifically cited Macy's as a company that may be able to hold its own against larger retail rivals.
Related: Why some retailers are winning big and others are losing
The Moody's analysts said Macy's strategy of letting people buy online and pick up at the store has helped boost sales. Shoppers tend to make other purchases when they come to pick up online orders.
Macy's has quoted a 25% increase in sales to these customers, the Moody's analysts noted.
What's more, Moody's praised Macy's for making it easier and convenient to use the online shopping site and app.
Moody's noted that Macy's was just one of two department store chains that let customers check prices on its app, track order history, do visual searches for products and also chat with customer representatives. Kohl's (KSS) was the other.
Macy's and Kohl's were also the only two department stores that accepted Apple and Samsung Pay, PayPal and mobile wallet payments from major credit card companies. Kohl's, by the way, has also enjoyed a turnaround this year. The stock is up 30%.
"Retail companies that embrace innovation can survive in the age of Amazon," said Matt Schreiber, president and chief investment strategist at WBI Investments, in a recent email.
"Macy's is making a comeback by revising its business model to better integrate e-commerce and brick-and-mortar," he added.
Still, some wonder if Macy's can continue to wow Wall Street.
Related: Don't count out Macy's just yet?
Morgan Stanley's Kimberly Greenberger, a top Wall Street retail analyst, said in May she thinks Wall Street has already rewarded the company for some easy, quick fixes. Now comes the hard part.
Greenberger is concerned overall sales are expected to remain flat this year and next. She said that Macy's needs to do more to get rid of underperforming stores.
"Even though Macy's is closing stores proactively, it may not be doing so quickly enough," she said.
Macy's will report its latest earnings on August 15.