The deal represents a dramatic turn in strategy for Amazon, which has offered food delivery through its AmazonFresh service for a decade, but has not made a major dent in the $700bn grocery market.
The deal is expected to close in the second half of 2017, pending shareholder and regulatory approvals.
"We believe it presents an incredible opportunity to take Whole Foods Market's mission and objective to new levels and will create significant value for our stakeholders - including you, our most loyal customers".
The all-cash transaction is valued at $13.7 billion, with Amazon assuming Whole Foods' debt.
Consumers could also see more Whole Foods stores thanks to Amazon's financial might.
Amazon, which is known for squeezing suppliers and has been experimenting with its own outlets, will take over a natural and organic grocer pioneer brimming with 456 stores and high-end shoppers but struggling to rein in prices and integrate technology.
Whole Foods, which will keep operating stores under its name, said in an email to customers that it will maintain the same standards under Amazon, including bans on artificial flavors and colors and antibiotics in hens producing its eggs.
Whole Foods stocks soared over 26 percent on the news.
Alina Gura of Newington who was visiting the Whole Foods store with her almost two-year-old daughter, said she appreciates the quality of the food, particularly its organic products.
Amazon is the world's largest online retailer by sales.
"I think that they are a very profit-driven company, so there might be some streamlining as far as labor", said Sasha Hardin, 28, of the Mount Pleasant store, who has been with Whole Foods for 6-1/2 years.
That was feeling of Taylor Malooly, 19, a University of Texas student at Whole Foods in Austin, who said a Whole Foods delivery service would have to be fast if he were to try it. Investors wondered if Amazon will do to grocery stores and supermarkets what it's done to sellers of goods like clothing and office supplies: force them to make big changes or be supplanted. The stores could teach cooking skills, hold classes and educate about food.
New Seasons in Northwest Portland has a special set of shelves where Amazon Prime pickers and packers place bags of groceries ready to be delivered locally in one hour, via Amazon Prime Now.
Amazon could also get a better picture of customers by marrying data from Amazon and Whole Foods' loyalty programs. It was recently granted a patent for technology that would block shoppers from comparing prices using their mobile devices while they are in stores.