Shoppers walk past a Walgreens store in New York City. The drugstore chain has entered a 20-year deal with Valeant Pharmaceuticals. Andrew Kelly/Reuters

By Greg Roumeliotis and Lauren Hirsch

(Reuters) -- Drugstore chain Walgreens Boots Alliance Inc (WBA.O) said on Tuesday it would acquire smaller peer Rite Aid Corp for $17.2 billion including acquired debt.

The $9-a-share cash deal would combine the second- and third-largest U.S. drugstore chains by sales, creating the largest U.S. retail pharmacy chain in numbers of stores.

The price represents a 48 percent premium to the closing price of Rite-Aid on Monday, the day before the agreement was signed, the companies said in a joint release.

A Walgreens-Rite Aid deal would need approval from the U.S. Federal Trade Commission, which studies retail mergers to ensure they comply with antitrust law.

Shares of Rite Aid, which had a market value of $6.36 billion at Monday's close, rose as much as 44 percent to $8.74 on Tuesday after the Wall Street Journal first reported the news. Walgreens stock rose as much as 7 percent to $95.48.

(Additional reporting by Siddharth Cavale in Bengaluru; Diane Bartz in Washington, Ransdell Pierson and Caroline Humer in New York; Editing by Lisa Von Ahn and Christian Plumb)