Macy's Inc. (M) stock soared nearly 12% to $30.70 after the opening bell, then slipped to $28.40 by the close, on Tuesday, Feb. 27, after the retailer released strong fourth-quarter earnings.

The company reported operating income of $1.21 billion, or 14% of sales, compared with $815 million or 9.6% of sales, for 2016's fourth quarter.  The company also reported a bump in cash flow year over year. 

Macy's posted revenue of $8.67 billion instead of the expected $8.68 billion, but 1.8% up year over year; earnings per share of $2.82 versus the expected $2.71; and a same-store sales rise of 1.3% versus expected growth of 0.1%. 

Fiscal 2017 earnings per diluted share were $5.04 compared with $1.99 per share in 2016. Sales for full-year 2017 totaled $24.8 billion, down 3.7% from total sales of $25.7 billion in fiscal 2016. 

"Consumer spending was strong in the fourth quarter, and we were ready with improved execution and great products across all categories. We were disciplined with our promotional cadence and maintained a good inventory position," Macy's CEO and chairman Jeff Gennette said in the statement. "We head into 2018 with an improved base business, healthy inventories, a focused and engaged organization and a clear path to return Macy's to growth."

Sale of more real estate is also in the cards for Macy's.

The company signed an agreement this month to sell several floors of its State Street Chicago store to a real estate fund sponsored by Brookfield Asset Management Inc. (BAM) for $30 million. The sale is part of Macy's overall plan, which has included shuttering unprofitable stores, including 11 more announced recently.

On Friday, the company declared a regular quarterly dividend of 37.75 cents per share, payable April 2, to shareholders of record at the close of business on March 15.

More from Stocks

Sears, Saudi Arabia, Bank of America and Cannabis - 5 Things You Must Know

Sears, Saudi Arabia, Bank of America and Cannabis - 5 Things You Must Know

Jim Cramer: Fed Should Worry Less About Inflation and More About the Economy

Jim Cramer: Fed Should Worry Less About Inflation and More About the Economy

Sears Finally Files for Chapter 11 Bankruptcy

Sears Finally Files for Chapter 11 Bankruptcy

From Catalogs to Catastrophe: A Sears Timeline

From Catalogs to Catastrophe: A Sears Timeline

What Happens to Sears Gift Cards and Warranties Now That Chain Is Bankrupt?

What Happens to Sears Gift Cards and Warranties Now That Chain Is Bankrupt?