A 5.9 magnitude earthquake centred in Virginia shook much of Washington, D.C., and was felt as far north as New York City and Martha's Vineyard, Massachusetts, where President Barack Obama is vacationing.