The merchandise trade deficit of the country widened to an eight-month high of $27.35 billion in July, according to government data released on Thursday.