Amazon.com, the online retail giant, made a major move into the brick-and-mortar world Friday, announcing that it would buy Whole Foods Market in a deal valued at $13.7 billion.

Amazon has recently begun experimenting with bookstores and a small grocery, but this is by far its most ambitious move into physical retail. The Seattle-based company was recently granted a patent for technology that would block shoppers from comparing prices from their mobile devices while they’re in stores.

In Whole Foods, it is acquiring a company that has recently come under pressure from investors for its lagging performance. Whole Foods, whose fleet of stores now numbers more than 430 locations, has found it difficult to attract more mainstream consumers as Walmart and other large chains have stepped up their sales of natural and organic products.

The organic grocer, which was founded in 1978, would continue to operate under its existing brand. Whole Foods chief executive John Mackey would remain as CEO after the purchase and the company would keep its headquarters in Austin. The merger offers a test of whether Amazon, which has generally built its business on low prices, can successfully integrate a grocer known for premium service and higher prices.

“This partnership presents an opportunity to maximize value for Whole Foods Market’s shareholders, while at the same time extending our mission and bringing the highest quality, experience, convenience and innovation to our customers,” Mackey said in a statement.

The deal is expected to close in the second half of 2017, pending shareholder and regulatory approvals.

The $42 a share offer from Amazon is a 27 percent premium over Whole Foods Market’s closing stock price on Thursday. Trading in Whole Foods was halted ahead of the announcement, according to Bloomberg.