A powerful 7.0-magnitude earthquake rattled Mexico City on Friday, swaying buildings, shattering windows and prompting people to rush into the street, authorities said.