NEW YORK ( TheStreet) -- Traditional supermarkets such as Kroger (KR) - Get Report and Safeway are schooling mass merchants Wal-Mart (WMT) - Get Report and Target (TGT) - Get Report in the business of selling fresh food and packaged goods, sending two of the nation's most formidable retailers back to the drawing board to reignite their sales.

The winning recipe for grocers Kroger and Safeway, which don't have to be retailers of everything, has been a result of investments in customer service, more competitive prices, and an expansion of health and wellness products. Ohio-based Kroger, which has 2,635 stores in 34 states, has notched an impressive 45 straight quarters of same-store sales increases in spite of the ruthless price competition in weekly circulars and online at Wal-Mart and others.

Kroger's natural foods, meat, deli and pharmacy departments all posted double-digit percentage same-store sales growth last year. Investors have subsequently pushed shares up 66% in the past year, compared to 3.2% and 36% gains for Wal-Mart and Target, respectively.

Kroger is in the process of investing billions of dollars into making its prices more affordable to entice customers who are visiting stores less, but are apt to spend more once they're in the store due to the decline in gas prices. But offering lower prices on veggies and toilet paper is only a part of what Kroger execs have done to take aim at the giant discounters.

"Even though natural and organic foods have been notoriously out of reach for many customers, we used our merchandising expertise, manufacturing base and buying power to make them affordable and accessible to all customers through Simple Truth, which continues to see double-digit sales growth," said Kroger CEO Rodney McMullen on a Mar. 5 earnings call.

Sales of Kroger's "Simple Truth" private label organics line hit $1 billion in annual sales for the first time in 2014, less than two years after their introduction. McMullen added that "while customers will always have evolving expectations for convenience, we have improved our prepared food offering to meet their changing needs, as well."

According to Nielsen point-of-sale data from 2014, Kroger's market share increased in 18 of the 20 markets outlined in the annual report, and was down slightly in just two markets. Wal-Mart is one of Kroger's top competitors in 15 of the 20 markets outlined in the Nielsen report -- Kroger's share increased in all of those markets.

Kroger did not respond to an email seeking comment.

Safeway, the second-largest U.S. grocery-store chain, agreed to be bought by Cerberus Capital Management'sAlbertsons in March 2014 for about $9.2 billion. The grocer's performance for 2014, its last as a public company, suggested it, too, was winning against Wal-Mart and Target.

Same-store sales excluding volatile fuel prices rose 2.8% last year, a quicker pace than the 1.7% gain in the prior year. Safeway's efforts were focused on redesigning the all-important center of its stores where its packaged foods and and other daily essentials are sold, enhancing the types of premium foods it offers, and increasing its local assortment. Catering to Hispanic and Asian shoppers was also an area of focus.

"Early results in stores that include these initiatives are strong, and performing above the rest of the company," said Safeway's then President and CEO Robert Edwards on a Feb. 19, 2014 earnings call.

Similar to Kroger's organics push via the Simple Truth brand, Safeway has been striving to capitalize on the health and wellness craze. Sales of Safeway's "Open Nature" private label organics line surged 42% in 2013 to about $200 million, according to comments made on its last earnings call in February. The company has over 450 Open Nature items for sale. To help it become more price competitive beyond often high-priced organics, Safeway launched 774 new private label products in 2013 -- private label sales are hovering around 28% of total grocery sales for the chain.

In other words, Wal-Mart's claim to fame in retail -- unbeatable low prices -- has faded as key competitors have cut prices. The effect was visible in Wal-Mart's sales line last year, as same-store sales of grocery items rose by a low-single percentage in the fourth quarter, and remained largely unchanged to down slightly for much of the year.

But there are also operational issues that execs at Wal-Mart U.S., led by new division President and CEO Greg Foran, are working through.

"As far as the fresh area it's pretty obvious, we've got to run a great fresh area here in the food business," said Wal-Mart CFO Charles Holley at a Mar. 4 investor presentation. He went on to note, "we (have) got to do a better job in our dairy areas and our bakery areas, and our meat areas--those are critical. I think we've upgraded some of those, but I think they have a longer way to go."

Wal-Mart is in the process of re-training employees so they identify spoiled produce more quickly and are aware of when to restock packaged food shelves.

After spending months visiting stores to see how Target can sell food better, Cornell has taken his first step to raising the retailer's game. Target said Monday that it hired PetSmart (PETM) executive Anne Dament to lead its grocery business. Dament previously was responsible for overseeing PetSmart's service business that generated $860 million a year, as well as helping to build out its customer analytics platform. Prior to Petsmart, Dament held numerous food merchandising positions at grocery store chain Safeway.

Dament will be tasked with bolstering key areas of the food business, such as health and wellness and prepared foods, in addition to improving layouts.

This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.