Walmart’s business improved on two key fronts in the most recent quarter: Traffic was up 1.2 percent at its U.S. stores, the big-box chain reported Thursday, and e-commerce sales growth picked up after a long stretch of deceleration.

The retailer said its stores were busier due to ongoing efforts to make them tidier and better-stocked. Executives added that the business likely got some help in the quarter from low gas prices, which may have left shoppers feeling flush, and ultra-hot weather, which often spurs them to buy seasonal items such as fans or pool toys.

Walmart also offered a sunnier outlook for the rest of the year, bumping up its earnings forecast. In this latest quarter, it pulled down $120.9 billion in revenue, a 0.5 percent increase over the same period last year. (Adjusting for currency fluctuations, revenue rose 2.8 percent to $123.6 billion.)

Online, Walmart saw sales growth of 11.8 percent, a reversal after several quarters in which growth was slowing down. Walmart has been investing heavily in building out its network of fulfillment centers and has been rapidly expanding its grocery pickup program, in which shoppers can buy their groceries online and pick them up at their local store. Brett Biggs, Walmart’s chief financial officer, told reporters Thursday said the better online sales performance is a sign the chain is starting to see the fruits of those efforts. Plus, it helps that Walmart is simply selling a much wider array of goods through its digital marketplace, which includes third-party sellers. In January, the site offered 8 million different items for sale; today, that’s up to 15 million.

Growth in the online business can’t come fast enough for Walmart, a distant second to in the e-commerce race. Walmart last week announced a a major gamble to build its digital muscle, saying it agreed to spend $3.3 billion to buy upstart The big-box chain also plans to install Jet’s founder, Marc Lore, as chief executive of Walmart e-commerce, a move that would put Lore’s fingerprints throughout its business.

In remarks to investors and reporters Thursday morning, Walmart painted a different picture of the recent retail landscape than its rival, Target, had put forward a day earlier. After a disappointing quarter, Target executives spoke of great week-to-week volatility in sales and patchiness in business geographically, with stores in California performing strongly and East Coast stores seeing weakness.

However, Walmart’s Chief Financial Officer Brett Biggs described a different market: “Overall, we’re seeing a consumer that’s acting pretty steadily.” Greg Foran, the chief executive of Walmart U.S., said the retailer also saw fairly consistent performance across merchandise categories. 

Comparable sales at Walmart’s U.S. business rose 1.6 percent in the quarter, making for eight consecutive periods of growth on that measure. While the uptick in traffic was the main driver of that growth, the retailer also recorded a 0.4 percent increase in “ticket,” or how much was spent per transaction. That suggests that when people came to Walmart, they were adding more items to their basket or were splurging on pricier goods.

Both Walmart and Target have been racing to improve their grocery offering, looking to spruce up their presentation of their merchandise and striving to have fresher, more enticing produce the shelves. At least during this quarter, Walmart appeared to have a leg up on its competitor. The chain saw positive comparable sales and an uptick in traffic in the grocery aisles, even as the industry overall saw a deflation in food prices. Target meanwhile, reported it recorded a decline in comparable sales in this department, despite intense effort to offer better quality and assortment.

Overall, profit jumped 8.6 percent to $3.8 billion; earnings per share rose 12 percent to $1.21. Walmart’s stock was up about 1.6 percent in pre-market trading.