Macy's Inc. (M) may yet have the last word.

About a week after the retailer got a nasty downgrade from Morgan Stanley, Macy's reported a stellar first-quarter earnings and sales beat and raised guidance for the year.

Shares soared 8.27% in morning trading Wednesday after Macy's reported adjusted earnings per share of 42 cents for the first quarter, easily topping FactSet analysts' expectation of 36 cents. Macy's also served up $5.5 billion in revenue, which beat forecasts of $5.4 billion for the quarter. Comparable sales on an owned and licensed basis grew 4.2% in the quarter, as well.

Macy's also raised guidance for the year and now expects adjusted earnings between $3.75 and $3.95 a share for fiscal 2018, which would represent as much as about 5% growth from the previous year and a 20-cent increase from previous 2018 estimates. Total sales are expected to range from a 1% decline to a 0.5% increase in fiscal 2018, Macy's said. Comparable sales on an owned plus licensed basis are expected to increase between 1% and 2%.

Macy's big quarter comes on the heels of a rough downgrade Morgan Stanley analyst Kimberly Greenberger sent to clients on May 10. In a downgrade to underweight from equal weight, Morgan Stanley cited Macy's negative store comps and declining return on invested capital that would create an "uphill battle" after the first quarter.

"We expect ROIC to deteriorate in 2018 after 1Q and thus expect the stock price to decline once again," Morgan Stanley wrote, noting that ROIC declined sharply from 2014 through the end of last year. "Furthermore, Macy's increased reliance on private label credit card income and real estate gains masks the underlying deterioration in core retail EBIT," analysts continued.

Credit card revenue as a percentage of net sales was 2.8% in the first quarter, down from 3% a year earlier. Gains on the sale of Macy's real estate was 0.4% in the first quarter, down from 1.3% a year earlier. Both credit card and real estate gains shrank as a percentage of net income, but at the same time, net income itself grew 70% to $131 million in the quarter. So much for "increased reliance."

Analysts also cited declining sales and profit pressure from eCommerce in its gloomy outlook for the company and the department store sector at large.

"While we have more work to do, the continuing improvement in our stores is encouraging and we once again achieved double-digit growth in the digital business. Our best customer is responding well to the improvements we've made to her experience in our stores, on .com and through the Macy's app," said Jeff Gennette, Macy's chairman and CEO, in a statement Wednesday.

Thanks for nothing, Morgan Stanley. Macy's stock has rallied 42.7% in the last year, up about 29% since the start of 2018.

More from Earnings

Jim Cramer on Why McDonald's Is a Safe Haven in a Volatile Market

Jim Cramer on Why McDonald's Is a Safe Haven in a Volatile Market

CalAmp Shares Plunge on Revised Guidance, Analyst Downgrades

CalAmp Shares Plunge on Revised Guidance, Analyst Downgrades

DSW Leaps as Shoe Retailer Posts Strong Earnings, Guidance

DSW Leaps as Shoe Retailer Posts Strong Earnings, Guidance

Big Lots Stock Suffers 23% Post-Earnings Drop

Big Lots Stock Suffers 23% Post-Earnings Drop

Trading Strategies: Understanding the Markets Going Into 2019

Trading Strategies: Understanding the Markets Going Into 2019