New York: Walmart raised its financial outlook for the year after beating Wall Street’s expectations for its fiscal second quarter and seeing the strongest growth in more than a decade in sales at established stores. Its shares surged 10% before the opening bell Thursday.

The report is strong evidence that Walmart’s efforts to improve the experience shoppers have at its stores and expand its online services, particularly in grocery, are helping bring people to its websites and stores. Like many other retailers, Walmart is also benefiting from a stronger job market and rising confidence.

Revenue at stores open at least a year rose 4.5% at Walmart’s US division, topping analysts’ expectations for a 2.4% increase. The measure is a strong indicator of a retailer’s health. The figure was helped by a more than 2% increase in customer traffic and in transactions. Online sales soared 40%, up from a 33% increase the previous quarter.

Since buying Jet.com for more than $3 billion two years ago, Walmart has been bolstering its online business by acquiring brands like Bonobos and ModCloth. It’s also working to speed up delivery to compete better with Amazon, and is expanding same-day grocery delivery. Walmart is also revamping its website with a focus on fashion and home furnishings and to highlight what services are available, like the ability to order groceries online and pick them up. It has also teamed up with Lord & Taylor to offer the department store dedicated space on its site.

Internationally, Walmart has been refocusing on areas with big growth potential like India and China. In May, it acquired a controlling stake in Flipkart, India’s largest online retailer, for $16 billion in its biggest acquisition yet. And it is selling its British unit, Asda, which has been struggling with intense competition from German no-frills discounters Aldi and Lidl.

For the quarter, Bentonville, Arkansas-based Walmart had a loss of $861 million, or 29 cents per share, because of some sizeable investments. It was also hurt by its investment in online retailer JD.com. Adjusted for those one-time costs, it earned $1.29 per share, easily topping Wall Street projections of $1.21 per share, according to Zacks Investment Research.

Revenue came to $128.03 billion, also beating projections.

Walmart now projects earnings for the current financial year of $4.90 to $5.05 per share, excluding charges related to Flipkart. Analysts expected $4.78 per share, according to FactSet.