The company also said it could look at suppliers outside China among other measures to mitigate any impact of tariffs it may face, as a trade war between the United States and China escalates.

Imported merchandise accounts for about 40 percent to 42 percent of Dollar Tree segment's total retail value purchases, making the company vulnerable to higher tariffs.

"We will not stand still like other sharks to the system," Chief Executive Officer Gary Phibin said, adding that it would be open to negotiating pricing concessions and changing product mix.

Dollar Tree posted a 1.80 percent rise in same store sales in the second quarter, below analysts' average estimate of 1.84 percent. Margins fell by 70 basis points due to higher freight costs, which the company said would continue to weigh on its results in the next two quarters.

Same-store sales at its Family Dollar business were flat, versus analysts' average expectation of a rise of 0.51 percent.

"The soft trends at Family Dollar and the tariff commentary gives us some pause," Telsey Advisory Group's Joseph Feldman said.

Bigger rival Dollar General Corp also said it was closely monitoring trade talks between the United States and China for any potential impact.

"We have long-standing relationships with many of our vendors, and we will continue to work closely with them to find ways to reduce costs," CEO Todd Vasos said on a conference call.

Dollar General executives did not elaborate on what measures the company would take to mitigate any impact.

The company also stuck to a plan for hefty investments in its store network, as it marginally increased its full-year outlook for sales, keeping its profit forecast intact for the second quarter in a row, sending its shares down 2 percent.

"We view the lack of a bottom-line increase (in the forecast) as likely more aggressive plans by management to invest upside back in the business," Oppenheimer analyst Rupesh Parikh said.

The company has been spending to open new stores, remodel existing ones and add more products to its shelves to better compete with Walmart Inc and newer rivals such as German discounters Aldi and Lidl.

Dollar General reiterated its annual profit target of $5.95 to $6.15 per share, the mid point of which was slightly below the average estimate of $6.06, according to Thomson Reuters I/B/E/S.

Dollar stores have taken a hit as shoppers spend more at big-box retailers such as Walmart and Target, with a strong job market and lower taxes putting more money in their hands.

Excluding items, Dollar General earned $1.52 per share, beating analysts' expectation of $1.49. Dollar Tree earned $1.15 per share, in line with expectations.

(Reporting by Aishwarya Venugopal in Bengaluru; Editing by Saumyadeb Chakrabarty)

By Aishwarya Venugopal