A trade deficit occurs when a country's imports of goods and services exceed its exports over a specific period. This imbalance indicates that more money is leaving the country to purchase foreign goods than is coming in from selling domestic products, which can affect the overall economy and its balance of payments.