user34174 linked an article which explains much of the techniques used: https://www.seis-insight.eu/en/public-2/martian-science/seismic-activity
To not have it lost as a volatile comment, I will paraphrase the relevant parts.
A marsquake emit both p-waves (faster) and s-waves (slower). Their relative arrival time can be used to calculate the distance within an error of 10%
The seismometer can measure waves in all three spatial directions. This allows calculating the direction the waves are coming from, within 10 degrees.
This is two degrees of freedom, sufficiently to estimate a position on a sphere.
In addition, if the quake is large enough, the surface waves travelling in the opposite direction can also reach the seismometer. At a magnitude of over 4.5, it can also observe the waves after travelling an additional round around Mars. These extra wavefronts can be used to increase the accuracy of the measurements.