Wal-Mart's earnings stops the retail bleed this week.

Shares of Wal-Mart (NYSE: WMT) shares surged 9.6% Thursday after the retail giant posted first-quarter results well ahead of Wall Street's expectations, proving itself to be one of the few retail success stories in recent months. The earnings beat comes on the heels of a disastrous week for retail stocks. Almost every retail company that reported earnings missed, and missed big. From Target (NYSE: TGT), to Nordstrom (NYSE: JWN), and JC Penny's (NYSE: JCP), all of these big named retail stocks seemed to be losing business to Amazon (NASADAQ: AMZN).

Well, Wal-Mart gets credited as the stock that stopped the retail slide this week. The company says their effort to provide shoppers with a better experience was a main factor in their high sales for the first quarter. Investors cheered the news sending Wal-Mart shares up $6.05 a share to close at $69.20.

Wal-Mart cited better pricing, selection and fully stocked shelves as helping to boost sales in grocery. Analysts have been focused on the grocery division of Wal-Mart as an area the company needs to improve. Analysts were also happy to hear that the company's smaller-format Neighborhood Market stores also brought in shoppers looking for fresh food or to fulfill pharmacy orders. Sales at Wal-Mart U.S. stores open at least a year increased 1%, the seventh consecutive quarter of growth for Wal-Mart's domestic business. Neighborhood Market same-store sales increased 7.1% in the quarter.

"Investment in wages, training and store improvements are beginning to pay off," said Wal-Mart U.S. CEO Greg Foran on a call with media, noting that customer service has gotten better and customers claim it's easier for them to find what they want.

Now, net earnings fell 7.8% to $3.1 billion from $3.3 billion in the same quarter last year, but this was primarily due to Wal-Mart's decision to pay higher wages. The company initiated the second phase of a plan that started last year to bring employees to a minimum of $10 an hour. Even with this new approach to higher earnings, the companies earnings per share came to 98 cents, beating analyst estimates for earnings per share of 88 cents.

Revenue increased 0.9% to $115.9 billion from $114.8 billion in the year-ago quarter. Analysts expected revenue of $112.7 billion, according to S&P Global Market Intelligence. It wasn't all good news though as its international segment struggled. Sales were down 7.2%, impacted by fluctuating exchange rates. Some analysts have argued that if you back out currency volatility, international sales were up 4%.

Lastly, Wal-Mart has been spending more on technology, ramping up its efforts to go head-to-head with rival Amazon. It's been expanding its service that offers store pick up for online grocery orders, and announced earlier this month that its three-day shipping program in pilot testing would be pared down to a two-day shipping guarantee. That puts it more in line with Amazon's subscription Prime service.