According to IRS Publication 17, under the Martial Status heading (linked to at the bottom of this answer) legally separated from your spouse means under a divorce or separate maintenance decree (as defined by state law, see the below).
State law governs whether you are married or legally separated under a divorce or separate maintenance decree. Some states consider living apart from each other, even without a separation decree to be legally separated.
https://www.irs.gov/publications/p17/ch02.html