(Reuters) - Amazon.com Inc plans to deliver packages to members of its loyalty club Prime in just one day, instead of two days, part of a spending ramp-up that may curb near-term profits and will up the ante for retail rivals such as Walmart Inc.

Shares rose as much as 2 percent in after-hours trade on Thursday as Amazon said faster shipping will come to customers around the world and said its profit more than doubled in the first quarter, trouncing estimates thanks to soaring demand for its cloud and ad services.

The news marks a costly challenge for competitors that will have to pour money into a logistics problem that even the king of e-commerce has yet to solve. Amazon expects to spend $800 million toward the shipping goal in the second quarter alone.

“There’s a lot of error bars around this program, especially from the cost side,” Amazon’s Chief Financial Officer Brian Olsavsky told analysts on a conference call. “We (are) again, trying to take advantage of the fulfillment capacity and transportation capacity, especially with third-party partners, that we have.”

While Olsavsky did not provide a concrete timeline for the program’s rollout, he said, “We expect to make steady progress quickly and through the year.”

U.S. rivals Walmart and Target Corp have steadily rolled out two-day shipping, albeit on far fewer items than Amazon Prime customers can get at that speed for $119 a year in the United States. Olsavsky said the “vast majority” of Amazon’s selection is available in two days, and the company has already expanded the number of goods eligible for same-day and two-hour delivery.

“Amazon is cranking it up a notch, trying to set themselves apart,” said Cathy Morrow Roberson, a former UPS analyst who founded consulting firm Logistics Trends & Insights.

She estimated that roughly 20 percent to 25 percent of Amazon’s shipping is currently within one day, noting that speedy service was easy in large U.S. metro areas where it already had built out its delivery network. However, costs can be prohibitive elsewhere.

“I don’t know how they are going to do it in ‘Little Town USA,’” she said.

FILE PHOTO: The logo of Amazon is seen at the company logistics centre in Boves, France, August 8, 2018. REUTERS/Pascal Rossignol

MORE PROFIT TO SPEND

Shifts in the nature of Amazon’s business have afforded the company windfalls that it now can apply toward its ambitious delivery program.

The company’s loyal customer base has drawn merchants to sell and increasingly advertise through its site in exchange for fees. In the first quarter, revenue from seller services jumped 20 percent to $11.1 billion, while ad and other sales surged 34 percent to $2.7 billion, the company said.

Meanwhile, Amazon’s cash cow, its cloud unit known as AWS that sells data storage and computing services to enterprises, saw operating income grow 59 percent to $2.2 billion.

The numbers reflect Amazon’s transformation from a low-margin retail business to a more lucrative marketplace and technology behemoth. While revenue growth slowed, profit surged to $3.6 billion in the first quarter, beating analysts’ expectations of $2.4 billion, according to IBES data from Refinitiv.

The company forecast net sales of between $59.5 billion and $63.5 billion for the second quarter, the midpoint of which was below analysts’ average estimate of $62.4 billion, according to Refinitiv data.

“Amazon delivered slower growth in all key segments – AWS, advertising and e-commerce – but margins skyrocketed, seemingly driven by less aggressive investment,” said Atlantic Equities analyst James Cordwell.

Olsavsky, Amazon’s CFO, said the company was still reaping rewards from prior years of hiring and investments in warehouses and other infrastructure. The company had managed and complied with regulatory changes in India, which only months earlier had caused Amazon some uncertainty. But investment would soon ramp up, he said.

Amazon estimated that second-quarter operating income would be as much as $3.6 billion, short of the $4.2 billion analysts were expecting, according to FactSet.

The company plans to spend more to roll out benefits to international Prime members. Hiring would also pick up from the 12 percent increase Amazon posted in the past 12 months, according to Olsavsky.

The company is delving into even less familiar terrain, too. It recently announced investments in self-driving and electric car companies, teasing how it thinks these high-tech, capital-intensive businesses could pay dividends potentially in the form of autonomous deliveries in the long run. Amazon has not described in detail its thinking behind the bets.

The initiatives reflect how the world’s largest online retailer has long invested in still-untested technology and programs, like its $13.7 billion purchase of Whole Foods Market to bolster home grocery deliveries.

The marches into new industries has been lucrative to shareholders, including its founder Jeff Bezos, who is the richest man in the world.