It was called the Tripartite pact. Perhaps the only time Hitler abided by a treaty
Numerous German generals were baffled by Hitler's declaration of war on the US. One wrote that they figured his grandchildren’s generation would be the ones that took out the United States.
US attacks Japanese would have triggered the Tri-Partite Treaty, not the other way around.
“Japan, Germany, and Italy agree to cooperate in their efforts on aforesaid lines. They further undertake to assist one another with all political, economic and military means if one of the Contracting Powers is attacked by a Power at present not involved in the European War or in the Japanese-Chinese conflict.”
Japan was not attacked. Hitler could have refused to declare war on the U.S. after Pearl Harbor, but chose to jump in anyway, ignoring not only his WWI experience of a two front war but taking on both the rest of Europe and the U.S. to boot.