By Nandita Bose

CHICAGO (Reuters) - Wal-Mart Stores Inc <WMT.N> said it plans to focus heavily on its e-commerce operations on Thursday and warned investors that the cost of the long-term plan would weigh on earnings over the next two years.

The strategy by the world's biggest bricks-and-mortar retailer, which includes slowing the pace of new store openings, is centered on cracking the dominance of Inc <AMZN.O> in online retailing and face off against other rivals like Target <TGT.N>.

Wal-Mart's shares were down 2.9 percent in afternoon trading at $69.59.

"This company over time will look like an e-commerce company," Chief Executive Officer Doug McMillon told investors gathered at Wal-Mart's headquarters in Bentonville, Arkansas.

Wal-Mart's plan includes doubling the number of its large warehouses focused on e-commerce sales to 10 in 2016, Reuters reported. It now has the ability to ship to most of the United States in one day.

The company spent more than $3 billion in August to buy e-commerce startup, which attracts millennial shoppers, and could help boost sales.

Wal-Mart is looking for online sales growth of 20 percent to 30 percent in the second half of this year, excluding the recent sale of Chinese website Yihaodian, and for even faster growth in the next few years.

Online sales currently account for about 3 percent of total sales.

Wal-Mart reined in its profit expectations as a result of its investments in e-commerce, now forecasting flat earnings for the fiscal year ending Jan. 31, 2018, down from a previous forecast of profit growth. It estimated capital expenses at about $11 billion, similar to this year.

Fiscal 2019 earnings-per-share growth is now likely to be at the low end of its previous forecast of 5 percent to 10 percent.

While the investments in online growth will be a challenge to margins, they are "essential for future-proofing the business for the long run", Cowen & Co analysts said in a research note.

The company has accelerated investments in e-commerce and digital from about $300 million in 2013 to $1.1 billion this year for a total of about $3 billion, excluding acquisitions, according to public filings and earnings reports.

Chief Financial Officer Brett Biggs said only about 20 percent of capital spending would go to store openings. Now the company plans to increase revenue from existing stores and its online business instead of new locations, which generated the bulk of growth in the past four years, he added.

In fiscal 2018, Wal-Mart plans to build 35 supercenters compared to 69 last year. It will only open 20 neighborhood markets from 161 last year.

(Reporting by Nandita Bose in Chicago; Editing by Lisa Von Ahn, Bernard Orr)