the amount of goods and services that a country exports, minus the goods and services that it imports *in a calendar year*. In 1999 Japan exported much more than it imported, so it had a trade surplus. The same year, the United States imported more than it exported, and therefore had a large trade deficit.
While Japan had a trade surplus and the USA had a trade deficit, both had something called a trade balance, which was negative for the USA and positive for Japan.
A country can have an overall trade deficit (like the USA in all years since 1980) and still have trade surpluses with individual countries (e.g., the USA occasionally has trade surpluses with Brazil).
Usually, when a country runs a trade surplus it tends to export the excess foreign currency back to the deficit country as portfolio investment. In this way, the foreign currency retains its value.