Subscribe

Target Had a Strong Holiday Season. But It Came at a Big Cost

The Target logo is displayed on the exterior of Target store on Sept. 25, 2017 in San Rafael, California. Justin Sullivan—Getty Images

Back in October, Target tgt made it clear it wasn’t going to let rivals Walmart wmt and Amazon.com amzn run away with the prize during the 2017 holiday season.

It seems its plan worked. The discount chain’s posted strong sales results in the fourth fiscal quarter, which ran from November to January, with the company reporting Tuesday that comparable sales rose 3.6% as Target kept its momentum following the peak Black Friday-to-Christmas period. More crucially for any retailer, shopper traffic was way up — as were online sales, which rose 29%, besting Walmart’s digital growth during the period.

Target has spent billions strengthening its e-commerce, remodeling hundreds of stores while opening more of its small format city locations, raising wages, and launching new brands — all efforts that help explain the positive performance. The company also made so-called “price investments,” retail speak for lower prices, to be sure not to be outflanked by its rivals. And it made a bigger bet on toys, looking to win some business from the problems at Toys ‘R’ Us.

More from FORTUNE

Those moves certainly took a bigger-than-expected toll on profits, which fell below Wall Street analysts, spooking investors and sending shares down 4% on Tuesday in premarket trading.

Excluding certain items, Target posted a profit of $1.37 per share in the quarter ended Feb.3, below the average estimate of $1.38. Total sales, helped by an extra week on the calendar compared to the previous year, rose 10% to $22.77 billion, beating the average Wall Street estimate of $22.53 billion.

Still, the strategy is helping Target reach its most urgent goal: getting more people into stores. Unlike Walmart, whose enormous grocery business ensures frequent visits from shoppers, Target is still refining its food offering after years of effort, meaning it has to use other levers to spur shopper traffic. (Grocery is about 56% of Walmart sales and about 20% at Target, which is a much smaller company.) In addition, it has launched or re-launched more than 10 of its own brands in the last year including the Cat & Jack kids line, which has been an enormous hit.

Target has also made it a priority to improve prosaic matters like supply chain and in-stock levels to reflect the new complexity of retail where every store is a node in the distribution system for order delivery and pickup. The chain’s 1,800 stores have sped up delivery and are part of its online surge during the holiday season. Indeed, Walmart’s online sales during the quarter grew more slowly than expected because of operational snafus.

About a year ago, Target announced a $7 billion investment plan aimed at restoring its “Tar-zhay” aura, and later on Tuesday it will conduct its annual investor day to provide updates. It already said this week it was spending hundreds of millions on store remodels in its hometown of Minneapolis, as well as in key markets such as Chicago, New York, and Los Angeles. Last year it bought delivery company Shipt for $550 million for its same-day delivery firepower.

Outbrain

More from FORTUNE