Build at least one ship, then their attacks are turned away unless they first send a blockcade, and blockades take a long time to arrive. Also build up some spys for defense, if they don't know what you have they won't attack you.
A little trick I just learned learned, that is still allowed but likely to be coded out of the game sooner or later, is that if you have ships and you blockade someone, then you capture any ships (just the goods on the ships actually) that go to that town during the blockade, including foreign ships coming to sell goods at that town. So if Player A puts a blockade on Player B's town, and then player B puts up Buy orders on his trading post at a high price for goods, and lots of people send their ships their to get that high price, player A will capture all those goods. An unscrupulous pair of individuals could make out like bandits. Though probably make a lot of enemies.
Here is a hit I made today: