There is no American law which prevents America from spying on non-Americans. We've signed no treaty that says we won;t spy on foreign countries. That means it is by definition legal for us to do so.
The laws in the article you linked to are all non-American, mostly from the Commonwealth Realms.
So? That's the whole point. American exceptionalism is thinking that Americans can break laws in other countries and get away with it because they're special. That's why the world hates Americans. They have double standards. They can break laws in other countries but if others come to America, woe betides them is they break the law.
The US government's job is to know what other governments are doing, therefore it has the power to spy on them. They, in turn, have the power to spy on it. We can argue the ethics of tapping Angie Merkel's phone all day, but you can't argue that there is a single law which gives a Head of Government the right not to be spied on.
Only during times of war. And the US has not legally declared war since WW2. You're making the argument that if everyone does it, it's not illegal.
And for those of you who are too lazy to use Google, here's some of the laws I'm talking about.
Karl's version of Parkinson's Law: Work expands to exceed the time alloted it.