Walmart reported 50 percent growth in online sales last quarter. (Alan Diaz/AP Photo)

The showdown between Walmart and Amazon is heating up — just in time for the holidays.

Walmart, which has worked hard to shed its image as an old-school retailer, on Thursday offered proof that its efforts are working: Online sales rose 50 percent, the company said, as more Americans flocked to Walmart.com for everyday items.

Shares of Walmart’s stock rose nearly 9 percent to an all-time high following the announcement.

“Walmart is firmly on the advance, both in its home market and elsewhere,” said Neil Saunders, managing director of GlobalData Retail. “From our data, it is clear that Walmart is not only getting existing customers to spend more online but is also attracting new shoppers.”

The online sales growth bodes well for Walmart as it enters the critical holiday shopping season. The retailer — which last year had $486 billion in revenue, more than three times Amazon.com’s $136 billion — has spent the past year aggressively expanding its online reach. It has spent billions buying up e-commerce sites like Jet.com, ModCloth and Bonobos, and has invested heavily in online grocery and same-day delivery programs.

Walmart — which tends to have sprawling stores in the outskirts of towns — is also making an effort to move into urban markets. Last month, the company bought courier service Parcel as part of an effort to provide same-day deliveries in New York. Its $3.3 billion acquisition of Jet.com last year was also a move in that direction, as it looks to win over more affluent, urban shoppers from rival Amazon. (Jeffrey P. Bezos, the founder and chief executive of Amazon, also owns The Washington Post.)

It has also beefed up its website: Walmart.com now offers 70 million items, more than three times what it did a year ago, and carries high-end brands like KitchenAid and Bose. Earlier this week, the company announced that it would also begin selling items from Lord & Taylor, the upscale department store chain, on Walmart.com.

“Our goal is to create a premium fashion destination on Walmart.com,” Denise Incandela, head of fashion for Walmart U.S. eCommerce, said at the time. “We see customers on our site searching for higher-end items, and we are expanding our business online to focus on adding specialized and premium shopping experiences.”

The earnings release comes as Walmart prepares to double-down on online and in-store discounts ahead of Black Friday. The company began offering holiday discounts two weeks ago, with $1 flashlights and $245 laptops, and will offer “doorbusters” deals online beginning at 12:01 a.m. Thanksgiving day. Stores will open at 6 p.m. on Thanksgiving.

Overall, Americans are expected to spend about $680 billion this holiday season, marking a 3.6 percent to 4 percent increase from last year’s $655.8 billion, according to estimates by the National Retail Federation. But analysts predict a fierce competition among retailers, and say a handful of companies, including Amazon.com and Walmart, are likely to see much of those gains. (A recent survey by accounting firm BDO, for example, finds that more than one-quarter of Americans plan to do most of their holiday shopping on Amazon.com this year.)

“There is definitely money to be spent this season, and both Walmart and Amazon are likely to pull customers from other competitors,” Saunders said. “Both have become destinations for a lot of shoppers.”

Earlier this week, shares of Target tumbled nearly 10 percent after the retailer warned that the holiday shopping season might not be as profitable as it had originally hoped. The company, which is offering free shipping on all orders through Dec. 23, said online sales rose 24 percent in the most recent quarter. Sales at stores open at least a year, meanwhile, increased 0.9 percent.

At Walmart, revenue rose 4.2 percent to $123.18 billion in the most recent quarter. Sales at U.S. stores open at least a year climbed 2.7 percent from a year earlier, which executives attributed to growth in grocery sales.

“The food business, in particular, has accelerated with our fresh meat, bakery and produce teams leading the way,” Doug McMillon, chief executive of Walmart, said in a Thursday morning call with analysts. “We have momentum.”

Read more:

Black Friday has already begun (at least according to these retailers)

Walmart’s holiday gift to employees: Longer hours

Hurricanes put a damper on retailers’ profits. Now they’re hoping for a cold winter.

Fidget spinners sold at Target contain lead, advocacy group says