Almost all countries require your clearance papers from clearing out in the prior country in order to clear in. The USA is one of the few countries that does not require clearing out and thus neighbouring countries will let you clear in without those forms when coming from the USA. But you will need your papers when returning to the USA and clearing in. The procedure when entering territorial waters of foreign nation is to hoist the Q-Flag (yellow flag, on starboard side) and then clear in as quickly as practicable.
Each country has its own rules for clearing in, most require that all crew remain aboard and only captain (armed with passports and paperwork) goes ashore to clear in. The USA requires that all people aboard come ashore to clear in.
The best list of rules and regulations plus a load of additional information, is available at http://www.noonsite.com