On November 25, 1936, Germany and Japan signed the Anti-Comintern Pact in Berlin, and the two countries agreed to share information and to consult on steps against the Communist International, the Soviet body that directed parties abroad, and in practice the agreement was aimed at the Soviet Union, and it drew the two governments closer at a time when both were building up their armed forces. The name was carefully chosen. The treaty did not promise that either side would go to war for the other, and that limit was noticed at the time, and it still marked a real step toward the alliance that would fight the war three years later.
Italy joined the pact in 1937, and other states in Europe and Asia signed later, and the group came to be called the Axis, and the agreement was renewed in 1941 with more members, and it was used by the partners to justify their stand against the Soviet Union, and it fed the fear in Moscow that Germany and Japan might attack from two sides. That fear was real. A border war between Japan and the Soviet Union in 1939 ended in a Japanese defeat, and it helped push the Japanese planners toward the south, and the pact did not keep its members from acting on their own interests when they chose.
The ties proved hard. The pact is remembered as one of the steps by which the powers that fought the Second World War took their places, and it came after Japan had left the League of Nations and after Germany had begun to rearm, and it was followed by a full military alliance between the two in 1940. Japan and Germany shared little and never fought side by side, and their aims in the war pulled in different directions, and the pact that began with words about a common enemy ended with the defeat of both its first members within a few years.