WASHINGTON (Reuters) - U.S. retailer Walmart Inc WMT.N reported strong second-quarter results and raised its earnings expectations for the year, temporarily sidestepping concerns around consumer demand in the wake of tariffs on imports from China.

FILE PHOTO: Walmart signs are displayed inside a Walmart store in Mexico City, Mexico, March 28, 2019. REUTERS/Edgard Garrido/File Photo

Walmart’s performance was helped by shoppers who spent more at its stores and websites, indicating the U.S. consumer economy has not lost steam, sending its shares up 6.1% to close at $112.69.

The world’s largest retailer posted a 20-quarter, or five-year, streak of U.S. growth, unmatched by any other retail chain.

On Wednesday, Macy's Inc M.N lowered its annual earnings outlook amid worries over tariff-related price hikes and the resultant impact on demand. On Thursday, JC Penney JCP.N posted a 9-percent drop in sales.

Analysts said the contrast in performance indicates there is no evidence to suggest a broad drop in demand in the economy and retailers posting lower growth need to improve their business strategies.

U.S. retail sales surged in July, which could help to assuage financial markets’ fears that the economy was heading into recession.

Consumers are responding to the changes the company is making to its business and the company is gaining market share, Chief Executive Doug McMillon said in a statement. Walmart gained share in grocery and general merchandise categories this quarter, the company said.

The retailer gets 56% of its revenue from food and grocery sales, which allows it to manage the pressure from tariffs better than many rivals, analysts said.

In an interview on Thursday, Chief Financial Officer Brett Biggs said Walmart has raised prices on some items due to these tariffs, but it is not passing all the cost pressure it faces to consumers.

It is managing that by negotiating with suppliers and sourcing from alternate supply bases, he said.

“We still feel good about the consumer overall,” Biggs said.

The company said it has expressed to the Trump administration that it wants negotiations with China to continue and communicated how this move impacts consumer and prices.

“We understand that free trade also has to be fair trade,” Dan Bartlett, executive vice president of corporate affairs, told reporters on a conference call.

A Walmart shopping trip was 5.2% more expensive in June than a year earlier, according to Gordon Haskett Research Advisors, which compared prices on a basket of about 76 identical items over the past year.

U.S. President Donald Trump raised tariffs on $200 billion of Chinese imports to 25% from 10% earlier this year, a move that has begun pushing up prices of thousands of products including clothing, furniture and electronics.

Earlier this week, Trump backed off his Sept. 1 deadline for imposing 10% tariffs on remaining Chinese imports, delaying duties on cellphones, laptops and other consumer goods, to shield U.S. holiday sales.

The move offered relief to the retail industry but will do little to mitigate the impact on consumers during the holiday season. Most retailers have purchased their holiday-season merchandise, and the inventory has for the most part already arrived at U.S. ports and warehouses.

NO CHANGE IN GUN SALES POLICY

Walmart has also come under growing pressure and criticism over its policy to continue selling firearms after two mass shootings, one at its store, killed 31 people in Texas and Ohio.

The retailer said its policy to sell guns has not changed.

It said it has about 2 percent of the market for firearms and is not among the top three sellers. It has a 20 percent share of the ammunition market.

“We’re encouraged that broad support is emerging to strengthen background checks and to remove weapons from those who have been determined to pose an imminent danger,” Chief Executive Doug McMillon said.

McMillon said “reauthorization of the assault weapons ban should be debated to determine its effectiveness in keeping weapons made for war out of the hands of mass murderers.”

Walmart’s Bartlett said it has also made clear that employees can express their concerns on gun sales and no employee’s job was in jeopardy for doing so.

A junior Walmart employee in California began a petition protesting the sale of firearms that gathered over 50,000 signatures. His access to Walmart’s emails and messaging systems was temporarily blocked.

Sales at U.S. stores open at least a year rose 2.8%, excluding fuel, in the quarter ended July 31. Analysts estimated growth of 2.07%, according to IBES data from Refinitiv.

Adjusted earnings per share increased to $1.27 per share, beating expectations of $1.22 per share.

The retailer raised its forecast for adjusted earnings-per-share to a “slight decrease to slight increase,” from a “decline by a low single-digit percentage range.” That forecast includes the effect from the acquisition of Indian e-commerce firm Flipkart.

Online sales surged 37%, in line with the previous quarter’s increase and higher than the company’s expectation of 35%.

Walmart’s online expansion has come at a cost to profitability and losses at the U.S. e-commerce business could rise to about $1.7 billion this year from $1.4 billion in 2018, according to estimates from Morgan Stanley.

Walmart is looking to sell ModCloth, the women’s apparel site it acquired two years ago, as it looks for ways to pare losses at its online business.

Total revenue rose 1.8% to $130.4 billion, beating analysts’ estimates for $130.1 billion.