Beth Hall/Bloomberg News

Amazon.com is buying an army of robots.

The online retailer announced on Monday that it is acquiring Kiva Systems, a maker of robots that service warehouses, for $775 million in cash. Amazon, a customer of Kiva’s, is buying the robotics company as it builds out its vast network of warehouses and tries to improve its margins.

“Amazon has long used automation in its fulfillment centers, and Kiva’s technology is another way to improve productivity by bringing the products directly to employees to pick, pack and stow,” Dave Clark, Amazon.com’s vice president of global customer fulfillment said in a statement. “Kiva shares our passion for invention.”

Kiva, based in North Reading, Mass., builds robots to help retailers manage their inventory and fulfill orders. Founded in 2003 by its chief executive, Mick Mountz — a former employee of Webvan, the once high-flying delivery service that folded after the dot-com bust — Kiva services many large retailers, like Gap, Staples and Saks. Its investors include Bain Capital Ventures, the venture capital arm of Bain Capital, and Meakem Becker Venture Capital.

“I’m delighted that Amazon is supporting our growth so that we can provide even more valuable solutions in the coming years,” Mr. Mountz said in a statement.

“Amazon has not had great margins,” Jason Helfstein, an analyst at Oppenheimer & Company. “One has to believe they looked at this and thought, ‘Why not just own it and take all the technology in house?'”

The acquisition comes as Amazon aggressively adds distribution centers to service its growing consumer base. The company has heavily promoted its Prime service, which provides customers two-day shipping for $79 a year. Last year, Amazon said it planned to add 17 warehouses, bringing its total to 69.

The transaction is expected to close in the second quarter of this year.

In the crowded world of e-commerce, the giant retailer has tried to differentiate itself with its wide breadth of products, its competitive pricing and fast delivery.

Folding Kiva into its system may also help Amazon trim costs. In filings, the retailer has discussed the difficulty of filling and tracking orders as it grows. “As we continue to add fulfillment and warehouse capability or add new businesses with different fulfillment requirements, our fulfillment network becomes increasingly complex and operating it becomes more challenging,” Amazon noted in a recent filing.

Kiva ranks as Amazon’s second-largest acquisition, behind its $847 million takeover of the shoe and accessories retailer Zappos.com in 2009.