The United States is the world's second-largest grocery market after China. This market is expected to grow at a compounded annual growth rate of 4.7% to reach $1.118 trillion in 2016, up from $940 billion in 2012. This means that there is substantial opportunity for companies such as Safeway (NYSE: SWY) and Kroger (KR 1.80%) that are operating in this space to take advantage of this trend. That being said, both Safeway and Kroger operate in a huge and competitive market, competing with the likes of Wal-Mart (WMT 0.46%), as the big-box retailer also sells groceries. We will take a look at each of them, especially Safeway, and see if they could be good investments given the projected growth of the industry overall moving forward.

Safeway is getting better
Safeway is the second-largest supermarket operator behind Kroger nation-wide and has been on a roll this year as seen in the chart below.

SWY Chart

SWY data by YCharts

Safeway has been going through restructuring and the performance of the stock shows that the moves management has been making have impressed investors. For example, Safeway disposed of its Canadian operations for $5.7 billion in June this year. It is also experimenting with the idea of "apartment over stores" with the aim of ensuring more traffic to stores. With the real estate market in Washington booming, this investment should be profitable in the long run. Apartments over stores should enable Safeway in gaining a loyal set of customers as those who stay in the apartments will usually prefer to shop at the Safeway store located below because of convenience.

Safeway also plans to carry on its store remodeling initiative forward and has plans to invest anywhere between $1 billion and $1.1 billion this year toward remodeling. In addition, Safeway also plans to exit the Chicago market, where it operates 72 Dominick's stores, by early 2014 and use the proceeds to invest in growth opportunities and also buy back shares. 

Also, the "Just for you" loyalty program has been a success and it is anticipated to bring in over six million members by the end of this year. In addition, it is promoting private-label brands in an attempt to increase profitability. Private-label sales were up by 34 basis points to 27.8% in dollar terms in the third quarter.

In the third quarter, Safeway's revenue came in at $8.6 billion, up 1.1% year-over-year. This driven by a 1.9% increase in comps, but was partly offset by lower fuel sales . Total revenue for the quarter beat Street estimates of $8.4 billion. Safeway gained market share in the U.S. for the sixth consecutive quarter as measured by the Nielsen Group and this is a positive sign going forward.

Kroger's different approach
While Safeway has been selling off assets, Kroger has been acquiring assets as a part of its growth plans. In July, Kroger announced the acquisition of Harris Teeter Supermarkets in a deal worth $2.4 billion. This will expand its reach in the Southeast and Mid-Atlantic U.S. markets. This transaction is expected to go through by the end of this year, although currently it is plagued by a series of lawsuits.

Kroger came up with strong results, and it has been braving competition by slashing prices. Despite stiff competition from Wal-Mart, Kroger managed to increase its market share in nine out of 17 markets. Kroger is also spending on its marketing initiatives as it looks to ward off competition from other players and it has recruited talent from other big retailers as well.

Wal-Mart's threat
Competition is stiff in the retail space and Wal-Mart has been making life difficult for grocers. Wal-Mart sells its merchandise, including grocery, at low prices and is moving into residential areas . According to Bloomberg Industries senior analyst Poonam Goyal, Wal-Mart is opening more stores in residential areas. It is also looking to make groceries more affordable and will be investing $6 billion to pursue this initiative.

Also, Wal-Mart's Great Gas Rollback program enables customers to save 10-15 cents per gallon on fuel purchases. This will be another point of concern for grocers such as Safeway and Kroger as Wal-Mart expands into neighborhoods and offers items for cheap .

SWY Profit Margin (TTM) Chart

SWY Profit Margin (TTM) data by YCharts

Moreover, Wal-Mart can afford to invest aggressively in its expansion plans as it has a superior profit margin as compared to Safeway and Kroger. However, as seen in the chart, it is quite evident that Safeway's profit margins have improved ever since the company started undertaking restructuring efforts and it can grow further. Meanwhile, Kroger has been quite consistent on the profitability front and its acquisitions can lead to better performance in the future.

Foolish Takeaway
Safeway has done extremely well this year but its run might not be over yet. As Safeway has been divesting its non-core businesses and getting leaner, it should perform better in the future. With earnings expected to grow at a growth rate of 26% annually for the next five years, it won't be surprising to see Safeway scale greater heights .