Moody's Investor Service has changed its mind about the U.S. retail sector and has turned bullish thanks to a robust U.S. economy that will propel the sector through 2019.

Specifically, Moody's said it sees the retail sector benefiting the most from investments in e-commerce and operating efficiencies.

The firm raised its 2018 forecast for retail operating income growth to between 4% and 5% from between 3.5% and 4.5%. Sales are now expected to grow between 4.5% and 5.5% from between 3.5% and 4.5%. 

"For the first time since July 2015, we are raising our outlook to positive from stable for the U.S. retail industry. This marks a big change from just a year ago, when swaths of the retail industry were still slogging through a rising tide of distressed names and defaults," Moody's retail team wrote. 

Moody's also sees that growth acceleration continuing into 2019, with retail industry operating income growing between 5% and 6% and sales growth matching 2018 levels. 

For the holiday season, Moody's expects "very healthy" retail sales growth between 5% and 6% with "a healthy U.S. economy, consumer confidence and increasing wage growth" aiding consumer spending. 

Moody's noted the dire straits the retail has sector has been in since late 2017 when "the retail industry still had the dubious distinction of holding the third-highest default rate among 18 U.S. corporate industries."

But the sector now benefits from a robust economy and a store rationalization process "that began in earnest about three years ago has helped many retailers streamline their operations and better provide their consumers with a seamless shopping experience."

Big retailers were gaining Thursday, bolstering Moody's thesis. 

Macy's Inc. (M - Get Report) shares were up 2.8%, while Kohl's Corp. (KSS - Get Report) gained 2.41%, Nordstrom Inc. (JWN - Get Report) jumped 3.66%, Target Corp. (TGT - Get Report) rose 2.72% and J.C. Penney Co. (JCP - Get Report) rose 1.75%. 

Sears Holdings Corp. (SHLD) was one of the retail laggards Thursday, however, following a report from CNBC that said CEO Eddie Lampert was attempting to renegotiate the terms of a loan agreement that would float the retailer through bankruptcy to better protect him. Lampert reportedly was asking to have the "first lien" on certain assets, which would put him in line to be paid back first. 

Sears shares are down more than 17%.