(CNN Money) -- Walmart is finding it somewhat more difficult than expected to compete head-to-head with Amazon.
The nation's largest retailer has been making tremendous gains in online sales, but those still represent only a fraction of its $500 billion in annual sales.
But the pace of online growth slowed more than expected in the quarter. Online sales were up 23% compared to a year ago, but slower than the 50% growth Walmart enjoyed during the first nine months of its fiscal year. It's also slower than the 40% growth it is projecting for this coming fiscal year.
Some of that slowdown in growth was because the company ran out of some items at its online fulfillment centers, said CEO Doug McMillon.
"We're learning how to deal with higher volumes and learning how to deal with a higher peak than what we had previously," said McMillon on a call with analysts.
But fulfillment issues don't account for all of the problems. The company also announced thinner profit margins as it needed to cut prices more than expected to compete with Amazon. It also hadincreased transportation costs, partly due to pricier fueland partly due to the cost offree two-day shipping program.
A year ago it launched free two-day shipping on online purchases of $35 or more, and unlike Amazon, it doesn't require customers to pay an annual membership fee to get that free shipping.
The thinner margin resulted in a 42% drop in income for the fourth quarter, which included the holiday shopping period. The decline comes despite a 4% rise in overall sales.
Sales in U.S. stores were up 2.6% in the quarter, which was better than the company had forecast. Still the news about the lower than expected earnings and thinner margins sent shares of Walmart 7% lower in early trading.
But the company is still making more inroads into online shopping than many traditional brick-and-mortar retailers. And executives say they're pleased with the online performance, despite some of the setbacks.
"This has not been our historic competency," said McMillon. "We're building something new. We've got some exciting things coming."
Even analysts who were generally pleased with the latest results saidthey still see signs of the difficulties Walmart is having as it tries to become more of an online power.
"We still believe Walmart has more work to do to widen its e-commerce customer base," said Neil Saunders, managing director of GlobalData Retail. "There are many demographics, especially younger and professional segments, for whom Walmart is not the destination of choice online. This isn't because it doesn't sell what they want or because the price or delivery options are suboptimal; instead, it is because they do not associate Walmart with online or they default to Amazon. This is a tough nut for Walmart to crack."