Walgreen Co posted quarterly earnings that fell short of Wall Street forecasts but better management of seasonal merchandise helped the largest U.S. drugstore chain improve margins and sent shares higher.

Walgreen's prescription and general merchandise sales were both pressured by the mild winter flu season, and consumers continued to hold off buying discretionary items.

As much as the early flu season helped our first quarter results, it hurt our second quarter results, Chief Executive Greg Wasson said in a statement.

Profit rose to $669 million, or 68 cents per share, in the second quarter ended on February 28 from $640 million, or 65 cents per share, a year earlier. The latest quarter included 2 cents per share in restructuring and other costs.

Sales rose 3.1 percent to $17 billion.

Analysts, on average, expected Walgreen to earn 71 cents per share on $17.17 billion in revenue, according to Thomson Reuters I/B/E/S.

Sales at stores open at least a year fell 0.2 percent. Same-store sales of general merchandise fell 1.6 percent while same-store prescription sales rose 0.6 percent.

Margins improved in the quarter as the company stocked fewer seasonal goods, such as Christmas decorations or Valentine's Day gifts, and was not forced to mark them down to the same extent as a year ago. Gross profit margins increased 0.5 percentage point to 28.8 as a percentage of sales.

Shares of the company rose 0.9 percent pre-market.

If Walgreen could increase, even slightly, the amount that shoppers buy in its stores it would have a major impact on profitability. Getting each shopper to buy about one more item, bringing the average number of items purchased to four, would double Walgreen's profitability, Chief Financial Officer Wade Miquelon told investors in January.

The company is updating its network of 7,180 stores and promoting health and wellness services such as clinics to drive growth. In February it reached a deal to buy New York-based drugstore chain Duane Reade to take the top spot in New York City.

Walgreen has its new store format in nearly 700 locations and expects to have it in as many as 3,000 stores by the end of the fall. Duane Reade is also busy updating its own stores.

Shares of Walgreen were up 0.9 percent at $35.66 in premarket trading. Shares of No. 2 drugstore chain CVS Caremark Corp were slightly higher and shares of No. 3 player Rite Aid Corp did not trade premarket.

(Reporting by Jessica Wohl; Editing by Michele Gershberg, Lisa Von Ahn, Dave Zimmerman)