Walmart on Tuesday reported earnings that missed analysts' expectations for the holiday period as its e-commerce operations cooled off, overshadowing the fact that same-store sales and revenue surpassed forecasts.

The company's gross margins took a hit during the quarter due to promotional activity and an ongoing war with Amazon to win a larger share of the grocery and apparel industries. The Arkansas-based retailer has been investing heavily to keep inventory fresh and stores appealing.

"During the quarter, [Walmart] had additional EPS headwind related to some smaller unplanned items and expenses we incurred as we pulled forward initiatives in order to take advantage of a higher tax deduction," CFO Brett Biggs said.

Meanwhile, sales made on Walmart.com slowed significantly, igniting fears that the big-box retailer won't be able to keep pace with Amazon.com. For comparison, Amazon's revenues, which include sales from grocer Whole Foods, jumped nearly 40 percent in the latest period.

Shares of Walmart fell more than 9 percent Tuesday morning on the news.

Here's how Walmart did compared with what Wall Street was expecting, based on a Thomson Reuters survey:

Earnings per share: $1.33, adjusted, vs. $1.37 expected

Revenue: $136.3 billion vs. $134.9 billion expected

U.S. same-store sales: an increase of 2.6 percent vs. a 2.2 percent rise expected

Walmart reported net income of $2.17 billion, or 73 cents a share, compared with $3.76 billion, or $1.22 cents per share, a year earlier. Excluding one-time items, Walmart earned $1.33 a share, falling 4 cents short of analysts' estimates.

Total sales in the fourth quarter of fiscal 2018 climbed 4.1 percent from a year earlier to $136.3 billion, topping Wall Street projections. Traffic at U.S. stores was up 1.6 percent, and the average shopper's ticket value grew 1 percent.

Same-store sales in the U.S. were up 2.6 percent, an increase for the 14th-consecutive quarter and higher than a projected rise of 2.2 percent. Same-stores sales of Walmart's wholesale Sam's Club division were up 2.4 percent, while nine of Walmart's 11 international business segments reported same-store sales growth during the latest period.

Online sales grew just 23 percent during the period, much slower than the prior quarter's 50 percent jump. It has been more than a year since Walmart acquired Jet.com, which gave the company an initial boost.

"Jet.com complements Walmart.com nicely," CEO Doug McMillon said on a conference call with analysts and investors. "Including online grocery, it has been the key driver of our e-commerce growth and that will continue."

Walmart has set its fiscal 2019 earnings-per-share forecast at $4.75 to $5. Same-store sales at Walmart U.S. stores are expected to climb at least 2 percent, while those at Sam's Club locations could rise as much as 4 percent. E-commerce sales are forecast to grow roughly 40 percent in the coming year.

"We're going to continue expanding our e-commerce businesses as it relates to food ... with online grocery ramping up," McMillon explained. "So we think by the time we get to the end of the year, and look back at the number for the total year, [e-commerce sales] will be approximately 40 percent."

Walmart is preparing to unveil a revamped website this year, with a focus on fashion and home goods. The company will partner with Lord & Taylor to sell the Hudson's Bay-owned chain's merchandise on Walmart.com, as it continues to expand its offerings on Jet.com (which include Uniquely J, Modcloth and Bonobos).

Just last week, Walmart began rolling out new apparel lines, adding to its online merchandise mix. The private labels are one way Walmart can boost its margins, when it's been forced to cut prices on other items such as electronics and appliances.

The retailer has endured a number of changes of late to its operating structure, inventory and leadership to compete further against Amazon.

For Walmart, news of starting wage increases and bonuses in January was abruptly followed by Sam's Club store closures, followed by layoffs at its headquarters and cutbacks of store co-managers. The company has been remodeling its stores across the U.S. to focus more on grocery and online order fulfillment.

"We still believe Walmart has more work to do to widen its e-commerce customer base," GlobalData Retail Managing Director Neil Saunders said in response to Tuesday's earnings report.

"There are many demographics, especially younger and professional segments, for whom Walmart is not the destination of choice online," Saunders added. "This is a tough nut for Walmart to crack, and one that it can only break by more heavily marketing its services and proposition."

Including Tuesday's losses, Walmart shares have risen about 35 percent from a year ago. As of Friday's market close (Monday being a holiday), the stock was up more than 50 percent.