As the comments alluded, to analyze purity at high purity, you analyze the impurities. I'll use XRF for this example, but ICP, MS, HPLC, or other methods could work in the same way.
With XRF's $1-2\%$ precision directly measuring the gold would give you a maximum supportable purity of $98-99 \%$. To verify a metal as $99.99\%$ the impurities are measured which are usually in the parts per million range, added up and subtracted from $\pu{100\%}$.
For example, let's say you have a gold bar with $\pu{35ppm}$ silver, $\pu{20ppm}$ copper, $\pu{10ppm}$ lead, and $\pu{5ppm}$ mercury with all other elements below a , $\pu{0.5ppm}$ detection limit (also called a threshold limit). The total impurity would be the total of the measured impurities and the detection limit of the unmeasured impurities. Note: most analysis is by metal basis which excludes the other elements that may be present.
$$\mathrm{Impurity = 35 + 20. + 10. + 5 + [0.5 \times (59-5)] = \pu{97 ppm} }$$
The $59$ is for the $59$ naturally occurring metal elements and the $5$ is for the five elements we measured ($\ce{Au, Ag, Cu, Pb, Hg}$). $\pu 2 \pu\%$ of $\pu{97ppm}$ is $\pu{1.94ppm}$ and the measurement plus the maximum error is $\pu{99\!.ppm}$. Taking $\pu{99\!.ppm} = \pu{0.0099\%}$ and subtracting from $\pu{100.00\%}$, we get an inferred purity of $\pu{99.991\%}$ Gold ($\mathrm{100\% - 0.01\% = 99.991\%}$). The gold would still be sold at $\pu{99.99\%}$ regardless of it being purer than needed as selling the gold by lots would be unnecessarily complicated and time intensive.