Walgreen Co. (WAG) said its fiscal second-quarter earnings eased as the drug-store operator was hit by weaker margins tied to a slowdown in generic drug introductions and a milder flu season.

The company also unveiled plans to close 76 drugstores in the second half of the year, reversing some of its rapid expansion in recent years. However, Walgreen still expects its store count to increase by 55 to 75 for the year.

A wave of generic drug introductions has pressured sales at drugstore retailers in recent periods, though those products carry higher margins than brand-name medicines. But in the latest quarter, gross margin fell to 28.8% from 30.1%, as the generic introductions slowed from the previous year's peak.

The shift in consumers' drug purchases toward generics has led pharmacy companies to take steps to improve their performance--including an alliance by Walgreen and European drug giant Alliance Boots with drug wholesaler AmerisourceBergen Corp. (ABC).

Chief Executive Greg Wasson said Walgreen "continued to gain prescription market share while we maintained a firm hold on our costs."

The company now expects cost savings during the second year of its partnership with Alliance Boots to generate $375 million to $425 million in cost savings, compared with the previous estimate of $350 million to $400 million.

For the period ended Feb. 28, Walgreen reported a profit of $754 million, or 78 cents a share, down from $756 million, or 79 cents a share, a year earlier. Excluding acquisition-related impacts and other items, adjusted earnings fell to 91 cents from 96 cents. Analysts polled by Thomson Reuters expected a per-share profit of 93 cents.

The latest period's adjusted earnings included a per-share contribution of 8 cents from Alliance Boots, at the high end of company estimates for seven cents to eight cents.

The company recently reported that total drugstore sales rose 5.1% to $19.61 billion, above analysts' expectations at the time.

Same-store sales improved 4.3%, including growth of 2% in the front of the store and a 5.8% increase in the pharmacy section. Same-store customer traffic fell 1.4%, while basket size increased 3.4%.

The store closing plans are expected to benefit adjusted per-share earnings by two cents to three cents starting during the next fiscal year. Walgreen also expects to post charges related to the move of $240 million to $280 million, mostly in the third and fourth quarters.

Write to Tess Stynes at tess.stynes@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires