Hitler never said he would attack the USA until the USA began breaking international law by providing free war materials to the UK.
Hitler was bound by the Tripartite Act to side with Japan. He was pissed about Pearl Harbor. In all actuality, he didn't even want war with the UK. Had the UK not declared war on Germany, he would have focused solely on Russia.
There are a number of theories as to why Hitler declared war, loyalty to his ally is not likely.
The real reasons most likely are twofold, Hitler knew he was already fighting an undeclared naval war vs the USA and believed the USA was unprepared for U boats (he was dead right, the USA suffered grevious shipping losses for the first 10 months of the war right off the US east coast). By declaring war he could set back an allied buildup of materials by years (this also happened) with rapid sub attacks.
The second and probaly most compelling reason was Hitler hoped japan would create a 'second front' in the far east, using their Kwang tung army located in Manchuria, this would relieve the pressure the germans were now getting from a december counter offensive near Moscow.
Its a fair bet Hitler cared little for any treaty he signed with Japan if there was no advangae for Germany.