ORIGINAL: Historiker
According to international law, war parties are allowed to enter neutral ports. This was done, for example, when the German East Asia Squadron visited Valparaíso in 1914.
I am not lawyer but i think they can use neutral port for no longer than 24h, they can resupply but not war materials like ammo etc. They can do repairs but only on minimal level allowing them to return to sea.
Also neutral port side can have more rules.
On September `39 Polish SS "ORP Orzeł" (Eagle) enter port of Tallinn (Estonia was neutral those days) to refuel and resupply. They where forced to give all weapons (torpedoes, shell etc and most of fuel) and sub was intern in harbor.
Polish crew took two Estonian soldiers as hostages (later send them ashore to Sweden with money and food) and escape to England.
Taking Orzeł intern and later escape was use by Soviets and Germans to question Estonian neutrality





