An 6.4 earthquake struck Yangbi County in western Yunnan province, China, on 21 May 2021, causing damage in the nearby region. Intensive foreshock activity started three days before the mainshock, and numerous aftershocks followed along a northwest–southeast‐trending right‐lateral main rupture fault. Double‐difference relocation of the foreshock and aftershock sequence shortly before and after the 6.4 mainshock is conducted using the phase picks from the local seismic network. The focal mechanisms of relatively large foreshocks and aftershocks are also derived. The results not only delineate the ruptured fault geometry during the mainshock but also indicate the mechanism of static stress transfer according to the spatiotemporal evolution of foreshocks. The low background b‐values around the mainshock are also consistent with the occurrence of the Yangbi earthquake sequence.