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

Nucor Shares Retreat Despite Nearly Doubling Q2 Earnings

Nucor Shares Retreat Despite Nearly Doubling Q2 Earnings

Microsoft Climbs After-Hours on Earnings Beat; Guidance to Be Announced on Call

Microsoft Climbs After-Hours on Earnings Beat; Guidance to Be Announced on Call

Dow Falls, Breaking 5-Day Winning Streak on Beige Book Trade-War Worries

Dow Falls, Breaking 5-Day Winning Streak on Beige Book Trade-War Worries

3 Must Reads on the Market From TheStreet's Top Columnists

3 Must Reads on the Market From TheStreet's Top Columnists

Nucor Retains Buy Recommendation From TheStreet Ratings

Nucor Retains Buy Recommendation From TheStreet Ratings