Pharmacy giant CVS Health has agreed to buy Aetna in a $69 billion blockbuster acquisition that could rein in health-care costs and transform its 9,700 pharmacy storefronts into community medical hubs for primary care and basic procedures, the companies announced Sunday afternoon.

The pharmacy chain agreed to buy Aetna for about $207 per share, broken down into $145 in cash and the rest in stock. The deal — the biggest health-care merger announced in more than a year — is expected to close in the second half of 2018, subject to approval by shareholders and regulators.

If approved, the megamerger would create a giant consumer health-care company with a familiar presence in thousands of communities. Aetna chief executive Mark T. Bertolini described the vision in an interview as “creating a new front door for health care in America.”