The US, like all other nations, has absolute sovereignty over its airspace. There is no clear line between airspace and space but 60,000 feet is clearly in the former.
The US, like all other nations except Lichtenstein for some reason, is a signatory to the Chicago Convention on International Civil Aviation which, among other things, makes it an act of war to use force against a civilian aircraft. Now, acts of war are not, per see, illegal - there are international laws about armed conflict and there are philosophical arguments about just and unjust wars but war itself is a political rather than a legal construct.
Article 5 of the convention gives the right to all other states the right to operate civil aircraft within US airspace (and vice-versa) without prior permission (apart from regularly scheduled flights which do require permission) subject to compliance with the convention. Relevantly, unmanned balloons are dealt with in Annex 4 - it states that permission is not needed for light meteorological balloons but is needed for any other balloon which might enter foreign airspace.
The Chinese claim that the balloon was “mainly” meteorological but the convention requires it to be “exclusively” meteorological. It also requires it to be “light” meaning having a payload weighing less than 4kg - unless the payload of this ballon was made of unobtainum, it weighed more than 4kg.
They also argue that it drifted off course and entered US airspace inadvertently. This would be a legitimate claim if the entry of US airspace was unlikely at the planning and launch stages of the operation. We simply do not have the information to assess this claim.
The US claim that this was a surveillance aircraft. If this is so, then the aircraft is not a civil aircraft and the Chicago Convention does not apply which brings us back to pure sovereignty - the US can do what it likes with things in its own airspace.
There is a treaty between NATO members and former Warsaw Pact members dating from the 1990s that allow surveillance overflights of each other’s territories. However, there are two problems with this: China was never a signatory, and the US withdrew during the Trump Presidency.
So, if this wasn’t a balloon that inadvertently and unexpectedly drifted off course, the US was allowed to shoot it down.