Measuring received power is pretty straightforward. Set up a receiving antenna some distance away. Make it at least 10 wavelengths, but even farther is better. Make sure the receive antenna has the same polarization. Transmit a carrier at a fixed power. Read the received power at the receive antenna with your spectrum analyzer.
If it's more convenient, you can also run this test in the other direction, transmitting with some other antenna, and receiving with the Yagi. Due to reciprocity, the results you obtain will be identical.
This doesn't tell you gain unless your spectrum analyzer is calibrated and you know the gain of your receiving antenna. Without the tightly controlled conditions of an anechoic chamber you probably can't know the receiving antenna's gain.
However, what you can do is perform the same test again and compare the results. If you are testing modifications to the Yagi you can compare the received power before and after the modification and quantity the change. You can also replace the Yagi with a reference antenna like a dipole for comparison.
If you receive twice the power with your Yagi versus the reference dipole, then you know the Yagi has 3 dB more gain than the dipole. While this isn't exactly a carefully calibrated, quantitative measurement of antenna gain, it is an objective way to validate that you have indeed constructed an effective antenna, that your Yagi is better than a $1 dipole, or that some modification or adjustment you've made to the Yagi has made a measurable improvement.