Dollar General (NYSE:DG) handily beat analysts' first quarter earnings expectations, posting net profits of $385 million, or $1.48 per share, on an 8.3% increase in revenue, which hit $6.6 billion.

With comparable-store sales also beating muted forecasts of a 2.8% gain by rising 3.8%, the deep discount chain was able to overcome the costs of the significant investments it is making to better position it for future growth.

Customers still coming

Unlike many retailers that post higher comps driven by price hikes, Dollar General was able to outperform based on a combination of customers spending more in its stores and increased traffic.

Comps are a key metric for retailers as it measures the strength of a business beyond the expansion of its store base. Companies can increase their same-store sales by raising prices, generating sales of more expensive items, seeing more customers visit, or a combination of all three. Despite the economy showing strength with low unemployment, rising pay, and improved consumer confidence, many retailers are still having trouble increasing store traffic.

Dollar General isn't one of them as it has reported four consecutive quarters with customer traffic coming in either flat or higher, and it recently launched initiatives to beat consumer expectations for a deep discount chain. For example, it began adding more consumables and fresh produce to its stores, which increases the appeal of shopping at the chain. The company says this effort also helped boost same-store sales (seasonal and home categories also helped, though apparel was not a hit this quarter).

However, by selling more consumables, Dollar General lowers its profitability, with gross margin declining 23 basis points to 30.2%. Consumables typically carry lower profitability than other product categories, though the retailer said much of the decline was actually the result of increased distribution and transportation costs.

Trade war worries

Rival Dollar Tree (NASDAQ:DLTR) also reported that higher freight costs ate away at margins this quarter, and both discounters are feeling the effects of the recent hike in List 3 tariffs that saw rates on many items sourced from China rise to 25%. Both are also whistling past the graveyard hoping the so-called List 4 items won't also become subject to higher tariffs, because it's a much more extensive list of goods that could negatively impact results.

Both Dollar General and Dollar Tree source a substantial majority of their goods from China, so the escalating trade tensions could have a material impact on their performance, but both are excluding the potential for List 4 tariffs from their guidance.

Yet where Dollar Tree was forced to revise its full-year earnings lower because of higher expenses from rising freight costs and costs associated with its turnaround plan at Family Dollar, Dollar General was able to reiterate its guidance. It foresees net sales growing 7% this year, comps rising 2.5%, and earnings coming in a range of $6.30 to $6.50 per share, which at its midpoint is 7% higher than a year ago. However, Dollar General's range is lower than the $6.65 per share analysts had forecast before the fourth quarter.

More improvements on the way

Still, the deep discounter is including the costs of its initiatives in its planning, and beyond adding more consumables, it is also expanding consumer technology solutions, such as self-checkout stations, and bringing its supply chain operations in house. Much of the $50 million it is spending this year on capital improvements is going toward its distribution efforts, with $25 million already spent in the first quarter.

These efforts will gnaw away at margins initially, but CEO Todd Vasos has said it will be accretive to sales and margins over time. With sales and comps higher this quarter, even with the minor degradation of gross margins, it appears the positive effects of these programs are already outweighing whatever negative costs come with it.

This article originally appeared in The Motley Fool.

Rich Duprey has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.

Manager arranges merchandise at a Dollar General store
Manager Doris Oransky arranges merchandise at a Dollar General store in Arvada, Colorado. REUTERS