Widening profit margins at Office Depot ( ODP) sparked an 18% gain in second-quarter profits, beating Wall Street's expectations. Sales were slightly below estimates.

The office supply retail chain posted earnings of $118.3 million, or 41 cents a share, for the quarter, up from the $100 million, or 31 cents a share, it recorded for the same quarter last year. Excluding charges related to a restructuring, Office Depot earned $125 million, or 43 cents a share.

Analysts, on average, were expecting earnings of 40 cents a share, according to consensus estimates reported by Thomson First Call.

Office Depot's total revenue rose 4% to $3.49 billion, falling short of Wall Street's forecast for sales of $3.51 billion. On a same-store sales basis, which measures sales at stores that were open for at least a year, the retailer posted a 1% increase over last year.

As for its margins, Office Depot said its gross profit as a percentage of sales rose by 10 basis points to 30.9%, and operating expenses declined by 70 basis points as a percentage of sales, to 25.9%.

"We achieved sales growth in each of our divisions, lowered total operating expenses, and expanded our operating margin," said Office Depot in a press release.

Office Depot's chairman and CEO, Steve Odland, joined the company last year from AutoZone ( AZO), an auto parts retailer whose largest stakeholder is Ed Lampert, the hedge-fund guru with ESL Investments who is now the chairman of Sears Holdings ( SHLD).

Under Odland, AutoZone stressed profitability over growth, and its operating margins doubled, while its stock price more than tripled during his tenure. Office Depot shareholders are betting that he can use a similar strategy to boost the retailer's stock price.

The company said its return on invested capital in the quarter was 10.5%, below last year's 11.4%, but after being adjusted for recent one-time charges, the company said its return improved to 13.9%. It repurchased roughly 7 million shares of common stock for $272 million.

So far this year, its shares have gained 15%, but the stock dropped in early trading on Friday on the top-line weakness. It was recently down 88 cents, or 2.4%, to $36.27.