CHICAGO (Reuters) - Wal-Mart Stores Inc on Thursday reported higher-than-expected quarterly sales at established U.S. stores, as investments to bring more customers into the discount retailer paid off and a bigger push into e-commerce boosted online purchases, sending its shares flirting near a 52-week high.

Wal-Mart and analysts said the company is benefiting from a $2.7 billion investment to increase entry-level wages and enhance the training of its workforce, which has led to better stocked shelves and cleaner stores. It said store visits rose 1.5 percent, the tenth consecutive quarterly increase.

Earlier in the day, shares of Wal-Mart rose to $77.40 - a 52-week high. They were trading at $77 in mid-day.

Wal-Mart’s efforts to close the gap with rival Amazon.com has started gaining momentum even as other retailers like department store chains struggle. Online sales for the Bentonville, Arkansas-based retailer rose 63 percent in the first quarter, which was higher than 29 percent growth in the fourth quarter and 20 percent in the third quarter.

Online sales added 0.8 percentage points to the first quarter comparable sales gain. Growth in the business has been picking up after Wal-Mart said in October it would slow down new store openings to focus on expanding its e-commerce business.

U.S. e-commerce chief Marc Lore told reporters in a call that online sales growth was boosted by offering free two-day shipping without membership fees, and higher repeat orders.

“We need to scale our e-commerce business further and see some additional strength in our store comps to deliver the results we know we’re capable of,” said Chief Executive Officer Doug McMillon.

Slideshow ( 4 images )

The company said most of the internet sales growth was from existing online operations rather than from acquisitions. Wal-Mart, which acquired Jet.com in 2016, this year alone has snatched up online retail startups Shoebuy, Moosejaw and Modcloth, and is currently in talks with small online clothing retailer Bonobos.

“Wal-Mart’s long string of investments in labor and e-commerce, including acquisitions, are enabling modest market share gains,” John Zolidis, director equity research with the Buckingham Research Group said.

Wal-Mart’s performance, along with rival Target’s results on Wednesday, bucked a string of weak results from retailers Macy’s Inc and J.C. Penney. Target reported higher-than-expected quarterly earnings and sales.

Wal-Mart said sales at U.S. stores open at least a year rose 1.4 percent, excluding fuel price fluctuations, and was the 11th consecutive quarterly increase. Analysts were expecting a 1.3 percent increase, according to Consensus Metrix.

Wal-Mart is aggressively investing in making prices more competitive compared to rivals. It has asked vendors to offer grocery prices that are 15 percent lower than competitors.

Wal-Mart’s U.S. Chief Executive Greg Foran said comparable sales in food and grocery improved during the quarter on lower food deflation, without sharing details. Grocery accounts for nearly 53 percent of overall revenue for the retailer.

Slideshow ( 4 images )

“Wal-Mart’s commitment to value pricing is driving traffic and growth in grocery and aggressive online strides are impacting comparable sales,” Cowen & Co’s senior research analyst Oliver Chen said in a note.

Earnings per share was $1 for the quarter ended on April 30, exceeding the analysts’ average estimate of 96 cents, according to Thomson Reuters I/B/E/S. Consolidated net income fell to $3.04 billion from $3.08 billion due to a higher tax rate.

Quarterly revenue rose 1.4 percent to $117.5 billion, slightly lower than analysts expectations of $117.7 billion due to a stronger dollar, which reduces the value of overseas sales. Revenue grew 2.8 percent on a currency neutral basis.

For the second quarter, Wal-Mart expects an increase of 1.5 percent to 2 percent in U.S. same-store sales. It forecast earnings per share of $1 to $1.08, against market expectations of $1.07.